Csound Csound-dev Csound-tekno Search About

[Csnd] Generating and playing score files from another instrument

Date2019-03-17 16:39
FromSyl Morrison
Subject[Csnd] Generating and playing score files from another instrument
Hi all, sorry in advance for long email!

For my major project in college I'm currently working on a midi generation plugin where the user enters a key, tonality, modifier (which weights the arrays differently), length and bpm, and it generates a midi file, with plans to extend automatic chord accompaniment and stuff. 
Essentially, I have my code generating a midi file which works grand (it sounds pretty bad at the moment I need to tweak the arrays once it's functional), but I'd like to implement a preview for the user so they don't have to drag each midi file in. 

So in parallel with the midi file, I'm also writing a score.txt which then gets parsed in csound and using scoreline to play the events to test them. (I'm using python for some of this, I'll attach the files). But if the user hits preview less than 3 seconds after generating the file, it makes horrible crackling noises, which kind of indicates some generating process is still running, so I guess my question is, is there a handy enough way to make sure the process is done before trying to play the score? Some sort of wait opcode, I did try putting in a kFinished variable but it didn't seem to do what I wanted it to. 

It IS written in Cabbage and I apologise if this is the wrong place for this but feel like it is much more a csound question than a cabbage one!

here's the code if anyone fancies taking a look,
Cheers,
Syl

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-03-18 19:43
FromRory Walsh
SubjectRe: [Csnd] Generating and playing score files from another instrument
Hi Syl, does the gkFinished test prevent playback until this code has finished running? I'm not really sure what the best way to do this is. If it consistently works after a short pause, perhaps you could just use schedule opcode with a delay instead of turnon

On Sun, 17 Mar 2019 at 16:39, Syl Morrison <honoonu@gmail.com> wrote:
Hi all, sorry in advance for long email!

For my major project in college I'm currently working on a midi generation plugin where the user enters a key, tonality, modifier (which weights the arrays differently), length and bpm, and it generates a midi file, with plans to extend automatic chord accompaniment and stuff. 
Essentially, I have my code generating a midi file which works grand (it sounds pretty bad at the moment I need to tweak the arrays once it's functional), but I'd like to implement a preview for the user so they don't have to drag each midi file in. 

So in parallel with the midi file, I'm also writing a score.txt which then gets parsed in csound and using scoreline to play the events to test them. (I'm using python for some of this, I'll attach the files). But if the user hits preview less than 3 seconds after generating the file, it makes horrible crackling noises, which kind of indicates some generating process is still running, so I guess my question is, is there a handy enough way to make sure the process is done before trying to play the score? Some sort of wait opcode, I did try putting in a kFinished variable but it didn't seem to do what I wanted it to. 

It IS written in Cabbage and I apologise if this is the wrong place for this but feel like it is much more a csound question than a cabbage one!

here's the code if anyone fancies taking a look,
Cheers,
Syl

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-03-19 11:27
FromSyl Morrison
SubjectRe: [Csnd] Generating and playing score files from another instrument
That was the hope for it, but it didn't, I ended up moving all the instruments to be triggered from init so init runs first, and realised there WAS a bug there that was stalling it but still have the horrible noise, unless I put in a .75 second delay before playing the score, it's such a weird one! 

On Mon, 18 Mar 2019, 19:43 Rory Walsh, <rorywalsh@ear.ie> wrote:
Hi Syl, does the gkFinished test prevent playback until this code has finished running? I'm not really sure what the best way to do this is. If it consistently works after a short pause, perhaps you could just use schedule opcode with a delay instead of turnon

On Sun, 17 Mar 2019 at 16:39, Syl Morrison <honoonu@gmail.com> wrote:
Hi all, sorry in advance for long email!

For my major project in college I'm currently working on a midi generation plugin where the user enters a key, tonality, modifier (which weights the arrays differently), length and bpm, and it generates a midi file, with plans to extend automatic chord accompaniment and stuff. 
Essentially, I have my code generating a midi file which works grand (it sounds pretty bad at the moment I need to tweak the arrays once it's functional), but I'd like to implement a preview for the user so they don't have to drag each midi file in. 

So in parallel with the midi file, I'm also writing a score.txt which then gets parsed in csound and using scoreline to play the events to test them. (I'm using python for some of this, I'll attach the files). But if the user hits preview less than 3 seconds after generating the file, it makes horrible crackling noises, which kind of indicates some generating process is still running, so I guess my question is, is there a handy enough way to make sure the process is done before trying to play the score? Some sort of wait opcode, I did try putting in a kFinished variable but it didn't seem to do what I wanted it to. 

It IS written in Cabbage and I apologise if this is the wrong place for this but feel like it is much more a csound question than a cabbage one!

here's the code if anyone fancies taking a look,
Cheers,
Syl

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here