Read successive lines of a file every X seconds, play sounds according to their content (musical sequencer).
in
Programming Questions
•
5 months ago
Hello,
I'm new to Processing, have a little project in mind, and don't know where to start. I'm currently reading a book to learn the language, so coming chapters may help me, but for now I just learned to draw rectangles (yay!).
I have a text file with a list of keywords on each line. What I need is: read the file, each X seconds, line after line, and display things or play sounds according to the keywords contained on each line. Then go to the next line.
For instance, the file would look like this:
(The ‘score’ file will actually be an adaptation of the Doctor Who timeline, the idea being to generate a piece of music from the characters coming and leaving the series' storyline. Each Doctor, each companion and each foe will be associated to one unique sound. The ‘piano’, ’cymbal’ and ‘guitars’ keywords are just place-holders.)
I guess the program would work something like this:
That's it. Do you have some advices before I dive into it? What should I know about reading (specific lines of) files and playing sounds?
Thank you for your help!
Nicolas.
I'm new to Processing, have a little project in mind, and don't know where to start. I'm currently reading a book to learn the language, so coming chapters may help me, but for now I just learned to draw rectangles (yay!).
I have a text file with a list of keywords on each line. What I need is: read the file, each X seconds, line after line, and display things or play sounds according to the keywords contained on each line. Then go to the next line.
For instance, the file would look like this:
- 1 piano
- 2 piano
- 3 piano cymbal
- 4 cymbal guitar
- 5 guitar organ
- …
(The ‘score’ file will actually be an adaptation of the Doctor Who timeline, the idea being to generate a piece of music from the characters coming and leaving the series' storyline. Each Doctor, each companion and each foe will be associated to one unique sound. The ‘piano’, ’cymbal’ and ‘guitars’ keywords are just place-holders.)
I guess the program would work something like this:
- EVERY X SECOND:
- Hide everything.
- Read line # (previous line + 1).
- Display line #.
- If the line contains ‘piano’: display picture ‘piano’ and read sound ‘piano’.
- If the line contains ‘cymbal’: display picture ‘cymbal’ and read sound ‘cymbal’.
- If the line contains ‘guitar’: display picture ‘guitar’ and read sound ‘guitar’.
- …
Thank you for your help!
Nicolas.
1