[Csnd] Fun with Csound and Python - Extremely Simple Music System
Date | 2011-11-13 13:21 |
From | zappfinger |
Subject | [Csnd] Fun with Csound and Python - Extremely Simple Music System |
Here is a little Python project I am working on. It is still a work in progress, but already shows the possibilities. Put the 2 files ESMS.py and ESMS_parser.py in one folder, then run the ESMS_parser.py. On OS X (Linux ?) systems you should hear 2 measures of music with chords, bass, snare, hihat and melody that follows the bass. By examining the code and comments you should be able to generate your own One Line Synth (OLS) and musical patterns. Enjoy! http://csound.1045644.n5.nabble.com/file/n4988453/ESMS_parser.py ESMS_parser.py http://csound.1045644.n5.nabble.com/file/n4988453/ESMS.py ESMS.py -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4988453.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-13 18:40 |
From | Rory Walsh |
Subject | Re: [Csnd] Fun with Csound and Python - Extremely Simple Music System |
Python is really great for this kind of thing! On 13 November 2011 13:21, zappfinger |
Date | 2011-11-13 19:31 |
From | zappfinger |
Subject | [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
I agree! It is a perfect marriage between my favourite programming language and favourite music generating system. -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4988979.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-13 21:06 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
I can't wait to play with this! On 11/13/11, zappfinger |
Date | 2011-11-13 21:37 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Works on Windows too! (Except not out of the box, but that's OK since I too am a Python programmer). This is actually almost exactly what I was thinking about implementing... although, where's the compressor? It sounds like it could use one! Great overall, however. On 11/13/11, Adam Puckett |
Date | 2011-11-13 21:55 |
From | zappfinger |
Subject | [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Good to hear! A better version is coming up soon. - functions add() and mul() take any number of arguments - an optional 'out' field lets you assign the output name, very usefull It might have a compressor too... Richard -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4989232.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-13 22:57 |
From | zappfinger |
Subject | [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Here is the improved version - It has a better hihat - the older one s*cked - instrument names are added as comments - fixed some bugs (p4 and p5 were swapped ...) - add() and mul() can have more than 2 arguments - out variable added to change the output variable name sorry, had no time to put the compressor in.... BTW, next versions will be put on my website, www.resona.nl, under software Richard http://csound.1045644.n5.nabble.com/file/n4989295/ESMS_parser.py ESMS_parser.py http://csound.1045644.n5.nabble.com/file/n4989295/ESMS.py ESMS.py -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4989295.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-13 23:50 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Richard, Quick question: How are you making those Nabble links? On 11/13/11, zappfinger |
Date | 2011-11-14 00:03 |
From | zappfinger |
Subject | [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Adam, When you reply, under the button 'More options' you can upload files. Richard -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4989390.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-14 00:14 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Attachments | balance.csd |
This is a test attachment. BTW, the CSD doesn't work. On 11/13/11, zappfinger |
Date | 2011-11-14 00:15 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
It's attached, no http link for me though. On 11/13/11, Adam Puckett |
Date | 2011-11-14 01:34 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Richard, I have two more suggestions about your algorithm: advance pos *after* you add the notes to the score (unless you wanted the rest in the beginning), and you can simply write your add and mul functions like this: def add(*args): return '(' + ' + '.join(args)+' / %s' % len(args) + ')' for mixing audio signals (ugly, I know, but it works.) Hope this helps, Adam On 11/13/11, Adam Puckett |
Date | 2011-11-14 09:01 |
From | zappfinger |
Subject | [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Hi Adam, Thanks for your suggestions. I guess in the add function you mean: def add(*args): return '(' + ' + '.join(args)+' )/ %s' % len(args) to scale down the signals? It is not ugly, it is very Pythonic ;-) BTW, I got your CSD file, it was attached... Richard -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4990150.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-14 09:59 |
From | zappfinger |
Subject | [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Hmm, My previous way allowed you to mix string and other types, like in mul(noise(), .5) noise() returns a string, 'anoise' by default, and the output of mul() is now: 'anoise*.5' So I changed to code back to what it was, unless there is a Pythonic way to do this... Richard -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4990293.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-14 13:39 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Yes, that is what I meant. Your add/mul functions should really look like this: def add(*args): return '+'.join(args) def mul(*args): return '*'.join(args) I just tried it in the interactive shell, and it's a more compact way to implement those functions. One more thing: Instead of calling print (because it's called different ways in Python 2 and 3), a version-agnostic approach to printing to stdout would look like this: def my_print(*args, file=None, sep=None, end=None): if file is None: from sys import stdout as file if sep is None: sep = ' ' if end is None: end = '' file.write(sep.join(args)+end) Hope this helps, Adam On 11/14/11, zappfinger |
Date | 2011-11-14 13:41 |
From | Andres Cabrera |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Hi, Have you had a look at ounk? http://code.google.com/p/ounk/ Cheers, Andres On Mon, Nov 14, 2011 at 9:59 AM, zappfinger |
Date | 2011-11-14 14:09 |
From | zappfinger |
Subject | [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Yes, Ounk is wonderful! I started this project to help me create CSD files... Adam, this works with strings only. So you cannot use add(1,2), but would have to use add('1','2') Richard -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4990848.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-14 14:14 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Richard, You can use list comprehensions like this: def add(*args): return '+'.join([str(i) for i in args]) On 11/14/11, zappfinger |
Date | 2011-11-14 17:37 |
From | zappfinger |
Subject | [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Yes! That is what I was looking for... Richard -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4991799.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-14 18:13 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Have you tried the my_print function? On 11/14/11, zappfinger |
Date | 2011-11-14 19:47 |
From | zappfinger |
Subject | [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
I cannot get it to work. It does not like the *args before the other arguments, so I placed that at the end. Then I got the following error: my_print( flist ) File "/Users/richard/Desktop/muziek/csoundTest/CsounDB/ESMS.py", line 247, in my_print file.write(sep.join(args)+end) AttributeError: 'list' object has no attribute 'write' apparently because the flist is now replacing the default 'file' argument? -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4992172.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-14 19:54 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Interesting... On 11/14/11, zappfinger |
Date | 2011-11-14 21:32 |
From | zappfinger |
Subject | [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
Adam, And now for something completely different - but related: I am thinking of extending the program with a MySQL database connection , to store most code, UDO's etc. In these modern days of computers and stuff it is madness that we have to cut and paste bits of text into a .CSD file to make some noise. ;-) What do you think? Richard -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4992523.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-14 22:24 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music System |
For me personally, why cut and paste when you have a quick reference? However, I do understand how most people think because I interact with them on a daily basis, and a MySQL database, if it would make your environment more comfortable for you, would be a nice addition to your growing API. On 11/14/11, zappfinger |
Date | 2011-11-16 21:22 |
From | Mark Van Peteghem |
Subject | Re: [Csnd] Re: Fun with Csound and Python - Extremely Simple Music |
Looks very interesting! The last few months I've been working on a rewrite of my Graphane library (also in Python), that makes it easy to write scores. I also intend to later manage orchestras with it; possibly using the same instrument storage as Blue (because I already have many instruments in there, and it allows parameterization of instruments). Op 13/11/2011 23:57, zappfinger schreef: > Here is the improved version > > - It has a better hihat - the older one s*cked > - instrument names are added as comments > - fixed some bugs (p4 and p5 were swapped ...) > - add() and mul() can have more than 2 arguments > - out variable added to change the output variable name > > sorry, had no time to put the compressor in.... > > BTW, next versions will be put on my website, www.resona.nl, under software > > Richard > > http://csound.1045644.n5.nabble.com/file/n4989295/ESMS_parser.py > ESMS_parser.py > http://csound.1045644.n5.nabble.com/file/n4989295/ESMS.py ESMS.py > > > > > -- > View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p4989295.html > Sent from the Csound - General mailing list archive at Nabble.com. > > > Send bugs reports to the Sourceforge bug tracker > https://sourceforge.net/tracker/?group_id=81968&atid=564599 > Discussions of bugs and features can be posted here > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > > |
Date | 2011-11-18 21:17 |
From | zappfinger |
Subject | [Csnd] Re: Fun with Csound and Python - Extremely Simple Music |
Thanks, Mark. It is a start and still growing. I am curious for your work. I like the idea of Blue importing instruments and effects. Likewise I want to import those too but also smaller building blocks like UDO's end ESMS intruments. Richard -- View this message in context: http://csound.1045644.n5.nabble.com/Fun-with-Csound-and-Python-Extremely-Simple-Music-System-tp4988453p5005598.html Sent from the Csound - General mailing list archive at Nabble.com. Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |