Essentially, what I want to do is get rid of MIDI files, when creating a sequencer. So, say I have a text file (that would be my pseudo-MIDI):

A  |----------------|
Bb |----------------|
C  |----------------|
Db |----------------|
D  |----------------|
Eb |----------------|
E  |----------------|
F  |----------------|
Gb |----------------|
G  |----------------|

As that sixteen - 's would be a bar. I want to create a user interface that has the contents of said text file (which I can do easily in Tkinter). But also, I want to have it so when the user loads the file, and presses "Play", it plays OGG or WAV files in accordance to where certain data is in the file. ie:

A  |:---------------|
Bb |-[]-------------|
C  |----------------|
Db |---:------------|
D  |----[--]--------|
Eb |--------::------|
E  |----------::----|
F  |------------::--|
Gb |----------------|
G  |----------------|

Where the : 's are, there would play a certain file, and where certan lengths of [--] 's would play longer files.

So, I need help. So far I have a way to list the lines in the file, but how would I go from there?

fileHandle = open (file)
	fileList = fileHandle.readlines()
	for fileLine in fileList:
		print '>>', fileLine
	fileHandle.close() 
	print fileList

(Note that the variable file is defined as file = raw_input("File: ") .

Recommended Answers

All 5 Replies

Let's see if I understand that right:

A  |:---------------|
Bb |-[]-------------|
C  |----------------|
Db |---:------------|
D  |----[--]--------|
Eb |--------::------|
E  |----------::----|
F  |------------::--|
Gb |----------------|
G  |----------------|

Where the ':' is a certain instrument from a wave file would play that note?

Essentially, yes:

Say there's : at the C. That'd play a file called, say, C_Short.wav , and a [--] at C would play C_Medium.wav , etc.

EDIT: Basically programming music.

Interesting, what module would you use to play each sound object?

Probably just the os module, with:

os.system("play xxx.wav")

Until I could find a better one (which I've been looking for)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.