blog.humaneguitarist.org

discoveries in digital audio, music notation, and information encoding

Archive for the ‘Sor’ tag

just goofin’ with a little Python CSV function and a limerickesque

leave a comment

This is probably a total waste of anyone's time but  …

The other night, after I'd worked on the Aguado Rondo (Op. 2, #2), I started goofing around with a little Python function that would turn a delimited text file into a Python dictionary, allowing me to target a specific cell in a delimited file, i.e. a "spreadsheet", without using the CSV module.

It works (well, at least I hope it does) this way:

films = csv2dict("films.txt", ";") #pass filename and delimiter
print films["title"] #print "title" column sans the header
print films["title"][-1] #prints last cell in the "title" column

It seems helpful to be able to do this. I've tested it with a UTF-8 file to write to file with some accent markings on people's names, etc. but I'm pretty sure it'll break on stuff I haven't thought of.

Anyway, maybe it'll come in handy to me for something.

Here's the function:

def csv2dict(fileName, delimiter):	
  f = open(fileName, "r") #open file
  lines = f.read() #read file
  f.close() #close file
  
  rows = lines.split("\n") #put lines in list
  headers = rows[0].split(delimiter) #put header titles in list
  rows.pop(0) #remove header from "rows" list

  i = 0
  worksheet = {}
  for header in headers: #for each header, i.e. each column
    columnCells = []
    for row in rows: #for each non-header row in delimited file
      if row != "":
        rowCells = row.split(delimiter) #get cells in row
        columnCells.append(rowCells[i]) #put column's cells in list
    worksheet[header] = columnCells #set header as KEY and set "columnCells" list as VALUE
    i = i + 1

  return worksheet

And for any guitarists out there, here's a little silly rhyme I wrote when living in my home eternal, Charleston, SC. I know the Sor as "warrior against the French" thing isn't accurate, but it helps the punchline.

:P

The title is, of course, that as Sor's famous duet.

"Le Deux Ami"

Fernando Sor,
who served in the war,
fought Bonaparte in the army.

But Dionisio Aguado,
who lacked such bravado,
preferred to run home to his mommy.
--------------

Related Content:

Written by nitin

February 16th, 2012 at 8:44 pm

OMET: Online Music Editing Tools

4 comments

Leveraging Ajax, the DOM and Lilypond for a web-based notation editor, from the latest edition of the Lilypond Report.

The article discusses OMET:

OMET, an acronym for Online Music Editing Tools, is a project to develop a group of web-based applications for creating professional-quality music manuscripts.

Basically, this is a browser-based GUI Lilypond editor. Very, very cool.

Right now it's limited to guitar scores – though nobody should take that to mean notating guitar music is a simple task, given all the resources of the instrument. Add to that the nature of polyphonic music notation on a single staff and, well, "issues" arise.

;(

I signed up for this project's mailing list to keep up-to-date with its progress.

BTW: Is that Fernando Sor's Opus 6, #6 I see in the article's screenshot?

--------------

Related Content:

Written by nitin

September 26th, 2010 at 10:55 am

Posted in music notation

Tagged with , , ,

Switch to our mobile site