diff options
author | Richard <richard@1bpm.net> | 2023-01-08 01:06:40 +0000 |
---|---|---|
committer | Richard <richard@1bpm.net> | 2023-01-08 01:06:40 +0000 |
commit | 6a8342a78bb65afbec9eac5693438a3107ff1dd3 (patch) | |
tree | 30b8cfb88d0544d089a78c776d214158d3642ab8 /BUG10 | |
parent | c4b6599d5995a00c85237f35d4f496b786fd7be1 (diff) | |
download | csd-unfixedbugs1-6a8342a78bb65afbec9eac5693438a3107ff1dd3.tar.gz csd-unfixedbugs1-6a8342a78bb65afbec9eac5693438a3107ff1dd3.tar.bz2 csd-unfixedbugs1-6a8342a78bb65afbec9eac5693438a3107ff1dd3.zip |
Diffstat (limited to 'BUG10')
-rw-r--r-- | BUG10/BUG10.csd | 218 | ||||
-rw-r--r-- | BUG10/bid.udo | 425 | ||||
-rw-r--r-- | BUG10/bid_source.udo | 139 | ||||
-rw-r--r-- | BUG10/bussing.udo | 62 | ||||
-rw-r--r-- | BUG10/instruments.udo | 238 | ||||
-rw-r--r-- | BUG10/txt_tools.udo | 82 | ||||
-rw-r--r-- | BUG10/wavetables.udo | 16 |
7 files changed, 1180 insertions, 0 deletions
diff --git a/BUG10/BUG10.csd b/BUG10/BUG10.csd new file mode 100644 index 0000000..2d19cf1 --- /dev/null +++ b/BUG10/BUG10.csd @@ -0,0 +1,218 @@ +<CsoundSynthesizer> +<CsOptions> +-odac +-m0 +</CsOptions> +<CsInstruments> +/* + Debugger - Unfixed Bugs : BUG #6 + + http://git.1bpm.net/csd-unfixedbugs1/about/ + + By Richard Knight 2021 + http://1bpm.net + q@1bpm.net + +*/ + +sr = 44100 +ksmps = 10 +nchnls = 2 +0dbfs = 1 +seed 0 + +#define NOFILEIO ## ; file IO with readfi not supported on all platforms: disables bid_loadfile + +gkmastergain init 1 ; master gain +gkpump = 0 ; kick ducking control +gksection init -1 + +#include "wavetables.udo" ; general waveforms +#include "bussing.udo" ; global audio bussing +#include "bid.udo" ; Bug Infested Directive tools and parsing +#include "instruments.udo" ; sound generators +#include "txt_tools.udo" ; text tools + +instr global_delay1 + aL, aR bus_read "delay1" + ifreq1 = (gibid_tempo / 60) / 4 + kfdbkL = abs(oscil(0.8, 1.67)) + kfdbkR = abs(oscil(0.8, 1.67)) + + atimeL = abs(oscil(0.2, ifreq1)) + 0.3 + atimeR = abs(oscil(0.2, ifreq1)) + 0.3 + + aLdlr delayr 1 + aLdel deltapi atimeL + aLdel butterhp aLdel, 130 + delayw aL + (aLdel * kfdbkL) + + aRdlr delayr 1 + aRdel deltapi atimeR + aRdel butterhp aRdel, 130 + delayw aR + (aRdel * kfdbkR) + + aLdel *= 1-gkpump + aRdel *= 1-gkpump + bus_mix("master", aLdel, aRdel) +endin + +instr global_delay2 + aL, aR bus_read "delay2" + aLdlr delayr 0.2 + kdeltime = abs(oscil(0.02, 0.04)) + 0.01 + aLdel deltapi kdeltime + 0.002 + delayw aL + (aLdel * 0.7) + aRdlr delayr 0.2 + aRdel deltapi kdeltime + 0.001 + delayw aR + (aRdel * 0.7) + ;aLdel *= 1-gkpump + ;aRdel *= 1-gkpump + bus_mix("master", aLdel, aRdel) +endin + +instr global_delay3 + aL, aR bus_read "delay3" + ifreq1 = (gibid_tempo / 60) / 8 + kfdbkL = abs(oscil(0.8, 1.63)) + kfdbkR = abs(oscil(0.8, 1.67)) + + atimeL = abs(oscil(0.2, ifreq1)) + 0.01 + atimeR = abs(oscil(0.2, ifreq1)) + 0.01 + + aLdlr delayr 1 + aLdel deltapi atimeL + aLdel butterhp aLdel, 130 + delayw aL + (aLdel * kfdbkL) + + aRdlr delayr 1 + aRdel deltapi atimeR + aRdel butterhp aRdel, 130 + delayw aR + (aRdel * kfdbkR) + + aLdel *= 1-gkpump + aRdel *= 1-gkpump + bus_mix("master", aLdel, aRdel) +endin + +/* + Master audio output +*/ +instr global_master + igain = 1 + aL, aR bus_read "master" + + awindex phasor giglitchsamples/sr + tablew aL, awindex*giglitchsamples, giglitchbufferL + tablew aR, awindex*giglitchsamples, giglitchbufferR + + aL limit aL*0.5, -1, 1 + aR limit aR*0.5, -1, 1 + outs aL*gkmastergain*igain, aR*gkmastergain*igain +endin + + +/* + Print notification of performance time since last notification + or if isection is -1, print completion notification +*/ +gitimetrack times +instr notify_change + isection = p4 + itime times + if (isection == -1) then + tt_notify(sprintf"Complete, runtime: %s", tt_parsetime(itime))) + exitnow + else + isectiontime = itime - gitimetrack + tt_notify(sprintf("%s : section %d complete in %s", tt_parsetime(itime), isection, tt_parsetime(isectiontime))) + gitimetrack = itime + endif + turnoff +endin + + +/* + Parse BID file and run the sequencer +*/ +instr parseandrun + tt_notify("Parsing events") + + #include "bid_source.udo" + bid_loadtext(SBID) + + tt_notify("Running sequencer") + event_i "i", "sequencer", 0, 3600 + turnoff +endin + +instr endfade + exitnow +endin + + + +instr sequencer + isection = 1 + event_i "i", "bid_setcurrentchord", 0, 1, isection, 0 + event_i "i", "global_master", 0, p3 + event_i "i", "global_delay1", 0, p3 + event_i "i", "global_delay2", 0, p3 + event_i "i", "global_delay3", 0, p3 + kmetro metro (gibid_tempo / 60) * 4 + kpos init 0 + kposabs init 0 + ksection init isection + kposchord init 0 + gksection = ksection + if (kmetro == 1) then + if (ksection > gibid_maxsection) then + ;event "i", "endfade", 0, gibid_beattime*8 + event "i", "notify_change", p3, 1, -1 + turnoff + endif + + bid_seq "hit1", kpos, ksection + bid_seq "snare", kpos, ksection + bid_seq "kick", kpos, ksection + bid_seq "hat1", kpos, ksection + bid_seq "bass1", kpos, ksection + bid_seq "melb1", kpos, ksection + bid_seq "hat2", kpos, ksection + ;bid_seq "glitchread", kpos, ksection + bid_seq "shaker", kpos, ksection + + + kpos = (kpos < 31) ? kpos + 1 : 0 + ksection16ths = bid_getsectionlength(ksection) * 4 + + if (kposabs+1 < ksection16ths) then + kposabs += 1 + else + event "i", "notify_change", 0, 1, ksection + ;event "i", "play_crash", 0, gibid_beattime*4 + ksection += 1 + kposchord = 0 + kpos = 0 + kposabs = 0 + event "i", "bid_setcurrentchord", 0, 1, ksection, 1 + endif + + + if (kposchord+1 < gkbid_chordlength*4) then + kposchord += 1 + else + kposchord = 0 + event "i", "bid_setcurrentchord", 0, 1, ksection, 1 + endif + + + endif + +endin + +</CsInstruments> +<CsScore> +i"parseandrun" 0 1 +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/BUG10/bid.udo b/BUG10/bid.udo new file mode 100644 index 0000000..17e9be2 --- /dev/null +++ b/BUG10/bid.udo @@ -0,0 +1,425 @@ +#ifndef UDO_BID +#define UDO_BID ## +/* + Debugger - Unfixed Bugs : BUG #5 + + Bug Infested Directive file parser v1 and tools + + Designed to create a reusable loop based score format in the Unfixed Bugs project and beyond. +*/ + + +#define BID_VERSION #1.1# + +#include "txt_tools.udo" + +; globals +gibid_tempo init -1 ; beats per minute +gibid_beattime init -1 ; time of one beat in second +gibid_maxsection init -1 ; max number of sections +gibid_chordfn init -1 ; current chord ftable +gkbid_chordlength init -1 ; current chord length + +; BID internals +gibid_sectionlengths ftgen 0, 0, -64, -7, 0 ; section lengths +gibid_sections[][] init 64, 64 ; section pointers to data +gibid_sectiondata[][] init 99, 6 ; section data, ftables contained + +gibid_chordgroups[][] init 16, 12 ; chord groups, pointers to sectionchords by section +gibid_sectionchords[] init 16 ; ftables of section chords + +gibid_currentchordnum = 0 ; current chord number +gibid_lastchordgroup = -1 ; last chord group +gibid_lastsection = -1 ; last section + +gSbid_sequenced[] init 1 ; internal tracking of sequenced elements +gibid_sequenceinit init 1 ; internal tracking of sequenced init +gibid_swingtime init -1 ; swing time calculated from percent + +/* + Get BID instrument index, creating new reference if specified. + Internal use only. + + index _bid_gettextindex Sname, [iaddifnotexists = -1] + + index BID instrument index + + Sname name to look up or create + iaddifnotexists 1=create , default=fatal if not exists +*/ +opcode _bid_gettextindex, i, Sj + Sname, iaddifnotexists xin + ifinalindex = -1 + index = 0 + while (index < lenarray(gSbid_sequenced)) do + if (strcmp(gSbid_sequenced[index], Sname) == 0) then + ifinalindex = index + igoto complete + endif + index += 1 + od + + if (iaddifnotexists == 1) then + if (gibid_sequenceinit == 1) then + gibid_sequenceinit = 0 + SequencedNew[] fillarray Sname + ifinalindex = 0 + else + SequencedNew[] init lenarray(gSbid_sequenced) + 1 + index = 0 + while (index < lenarray(gSbid_sequenced)) do + SequencedNew[index] = gSbid_sequenced[index] + index += 1 + od + SequencedNew[index] = Sname + ifinalindex = index + endif + gSbid_sequenced = SequencedNew + igoto complete + else + tt_notify_fatal(sprintf("Sequenced index for '%s' not found", Sname)) + endif + +complete: + xout ifinalindex +endop + + + +/* + Parse a row of comma-separated numerical values of either patterns or chords. + Internal use only. + + inum _bid_parserowitems Sline, ix1, ix2, imode + + inum number of elements found parsed + + Sline input line + ix1 array dimension 1 index + ix2 array dimension 2 index + imode 0=count elements; 1=write patterns; 2=write chords +*/ +opcode _bid_parserowitems, i, Siii + Sline, ix1, ix2, imode xin + inum = 0 + while (strlen(Sline) > 0) do + icomma = strindex(Sline, ",") + Stemp = strsub(Sline, 0, icomma) + icomma = (icomma == -1) ? 0 : icomma + Sline = strsub(Sline, icomma + 1) + if (imode == 1) then + tabw_i strtod(Stemp), inum, gibid_sectiondata[ix1][ix2] + elseif (imode == 2) then + tabw_i strtod(Stemp), inum, gibid_chordgroups[ix1][ix2] + endif + inum += 1 + od + xout inum +endop + + +/* + Read BID data for specified element and trigger accordingly. + + bid_seq Splayer, kposition, ksection + + Splayer name of BID element + kposition position in pattern provided by master sequencer + ksection section in composition provided by master sequencer + +*/ +opcode bid_seq, 0, Skk + Splayer, kpos, ksection xin + Sinstrument = sprintf("play_%s", Splayer) + instrindex = _bid_gettextindex(Splayer) + kdata = gibid_sections[ksection][instrindex] + + if (kdata != -1) then ; null section + kon = tablekt:k(kpos, gibid_sectiondata[kdata][0]) + + if (kon == 1) then + kchance = tablekt:k(kpos, gibid_sectiondata[kdata][3]) + if (random:k(0, 1) < kchance) then + ktime = (kpos % 2 == 0) ? 0 : gibid_swingtime + kdur = tablekt:k(kpos, gibid_sectiondata[kdata][1]) * gibid_beattime + ;kamp = tablekt:k(kpos, gisectiondata[kdata][2]) + event "i", Sinstrument, ktime, kdur, kpos, kdata + endif + endif + endif +endop + + +/* + Get a parameter for the specified pattern position. + ipos and idataindex are provided as p4 and p5 to instruments scheduled by bid_seq, + hence can typically used as bid_getparameter(p4, p5, iparameter) + + idata bid_getparameter ipos, idataindex, iparameter + + idata the resulting value + + ipos position in pattern + idataindex section specific data index; pointer to ftable + iparameter parameter index as in BID file; defaults include 0=on/off, 1=duration, 2=amp, 3=chance + +*/ +opcode bid_getparameter, i, iii + ipos, idataindex, iparameter xin + xout tab_i(ipos, gibid_sectiondata[idataindex][iparameter]) +endop + + +/* + Get a section length in beats + + klength bid_getsectionlength ksection + + klength length in beats + + ksection section to look up +*/ +opcode bid_getsectionlength, k, k + ksection xin + xout tab:k(ksection, gibid_sectionlengths) +endop + +/* + Parse a row of comma-separated values to either section patterns or chord storage. + Scans row, assigns ftable of appropriate length and then fills ftable. + Internal use only. + + _bid_parserow Sline, ix1, ix2, imode + + Sline line to parse + ix1 array dimension 1 index of target storage + ix2 array dimension 2 index of target storage + imode 1=section patterns, 2=chords +*/ +opcode _bid_parserow, 0, Siii + Sline, ix1, ix2, imode xin + isize = _bid_parserowitems(Sline, ix1, ix2, 0) + if (imode == 1) then + gibid_sectiondata[ix1][ix2] ftgen 0, 0, -isize, -7, 0 + elseif (imode == 2) then + gibid_chordgroups[ix1][ix2] ftgen 0, 0, -isize, -7, 0 + endif + isize = _bid_parserowitems(Sline, ix1, ix2, imode) +endop + + + +/* + Parse a line from a BID string + Internal use only. + + idataout[] _bid_parseline Sline, idatain[] + + idataout[] state data + + Sline line to parse + idatain[] state data + +*/ +opcode _bid_parseline, i[], Si[] + Sline, idata[] xin + iparameter = idata[0] + isection = idata[1] + ichordnum = idata[2] + isectiondataindex = idata[3] + imode = idata[4] + + if (strlen(Sline) > 0) then + Sfirstchar = strsub(Sline, 0, 1) + + ; comment + if (strcmp(Sfirstchar, ";") == 0) then + ; no action + + ; version check + elseif (strcmp(Sfirstchar, "v") == 0) then + imode = 0 + iversion = strtod(strsub(Sline, 2)) + if (iversion != $BID_VERSION) then + tt_notify(sprintf("Incompatible BID file version: got %.2f , expected %.2f", iversion, $BID_VERSION)) + exitnow + endif + + ; section header + elseif (strcmp(Sfirstchar, "s") == 0) then + imode = 1 + icomma = strindex(Sline, ",") + isectionnum = strtod(strsub(Sline, 2, icomma)) + Sub = strsub(Sline, icomma+1) + icomma = strindex(Sub, ",") + isectionlength = strtod(strsub(Sub, 0, icomma)) + ichordgroup = strtod(strsub(Sub, icomma+1)) + gibid_sectionchords[isectionnum] = ichordgroup + tabw_i isectionlength, isectionnum, gibid_sectionlengths + + ; tempo + elseif (strcmp(Sfirstchar, "b") == 0) then + imode = -1 + icomma = strindex(Sline, ",") + gibid_tempo = strtod(strsub(Sline, 2, icomma)) + gibid_beattime = 60 / gibid_tempo + iswingpercent = strtod(strsub(Sline, icomma+1)) + gibid_swingtime = ((gibid_beattime/4)/100) * iswingpercent + + ; chord group header + elseif (strcmp(Sfirstchar, "c") == 0) then + imode = 3 + ichordgroup = strtod(strsub(Sline, 2)) + ichordnum = 0 + + ; pattern header + elseif (strcmp(Sfirstchar, "i") == 0) then + imode = 4 + iparameter = 0 + + icomma = strindex(Sline, ",") + instrindex = _bid_gettextindex(strsub(Sline, 2, icomma), 1) + Sub = strsub(Sline, icomma+1) + icomma2 = strindex(Sub, ",") + isection = strtod(strsub(Sub, 0, icomma2)) + if (isection > gibid_maxsection) then + gibid_maxsection = isection + endif + if (icomma2 != -1) then ; repeat or null section + irepeatsection = strtod(strsub(Sub, icomma2+1)) + if (irepeatsection == -1) then + inewsection = -1 + else + inewsection = gibid_sections[irepeatsection][instrindex] + endif + gibid_sections[isection][instrindex] = inewsection + else + isectiondataindex += 1 + gibid_sections[isection][instrindex] = isectiondataindex + endif + + ; chord row + elseif (imode == 3) then + _bid_parserow(Sline, ichordgroup, ichordnum, 2) + ichordnum += 1 + + ; pattern row + elseif (imode == 4) then + _bid_parserow(Sline, isectiondataindex, iparameter, 1) + iparameter += 1 + endif + endif + idata[0] = iparameter + idata[1] = isection + idata[2] = ichordnum + idata[3] = isectiondataindex + idata[4] = imode + xout idata +endop + + +/* + Parse a Bug Infested Directive Format string to global arrays, ftables and variables. + Handles patterns, tempo, chord groups and sections etc accordingly. + + bid_loadtext Sfile, [imode = 0] + + Stext directive data as string to parse +*/ +opcode bid_loadtext, 0, S + Stext xin + idata[] fillarray -1, -1, -1, -1, -1 +read: + index = strindex(Stext, "\n") + if (index != -1) then + Sline = strsub(Stext, 0, index) + Stext = strsub(Stext, index + 1) + idata[] _bid_parseline Sline, idata + + igoto read + else + igoto complete + endif + +complete: +endop + + +/* + Parse a Bug Infested Directive Format string to global arrays, ftables and variables. + Handles patterns, tempo, chord groups and sections etc accordingly. + Requires readfi support which is not available on all platforms. Platforms that do not support that + should set NOFILEIO. + + bid_loadfile Sfile + + Sfile directive file to parse +*/ +opcode bid_loadfile, 0, S + Sfile xin +#ifdef NOFILEIO + tt_notify_fatal("Attempting to use parsefile when NOFILEIO is set") +#else + if (filevalid(Sfile) == 0) then + tt_notify(sprintf("Directive file cannot be found: '%s'", Sfile)) + exitnow + endif + idata[] fillarray -1, -1, -1, -1, -1 +read: + Sline, ilinenum readfi Sfile + Sline = tt_stripnewline(Sline) + + idata[] _bid_parseline Sline, idata + + if (ilinenum != -1) igoto read +#endif +endop + + + +/* + Set the current chord given a section + p4 the section number + p5 0=start at beginning, 1=increment chord index +*/ +instr bid_setcurrentchord + isection = p4 + ichordincrement = p5 + if (isection > gibid_maxsection) then + turnoff + endif + + ichordgroup = gibid_sectionchords[isection] + if (ichordgroup != gibid_lastchordgroup || isection != gibid_lastsection) then + gibid_currentchordnum = 0 + gibid_lastchordgroup = ichordgroup + gibid_lastsection = isection + elseif (ichordincrement == 1) then + if (gibid_currentchordnum + 1 < lenarray(gibid_chordgroups, 2) - 1) then + if (gibid_chordgroups[ichordgroup][gibid_currentchordnum + 1] == 0) then + gibid_currentchordnum = 0 + else + gibid_currentchordnum += 1 + endif + else + gibid_currentchordnum = 0 + endif + else + gibid_currentchordnum = 0 + endif + + ifn = gibid_chordgroups[ichordgroup][gibid_currentchordnum] + + if (ifn > 0) then + gkbid_chordlength = tab:k(0, ifn) + gibid_chordfn = ifn + endif + + if (timeinstk() > 2) then + turnoff + endif +endin + + +#end + diff --git a/BUG10/bid_source.udo b/BUG10/bid_source.udo new file mode 100644 index 0000000..e55c5f5 --- /dev/null +++ b/BUG10/bid_source.udo @@ -0,0 +1,139 @@ +/* + Debugger - Unfixed Bugs : BUG #10 + + Bug Infested Directives source + Provided as a string due to readfi not being available on all platforms. + Used with bid_loadtext (whereas a separate file would be used with bid_loadfile and requires readfi support) +*/ + +SBID = {{ +; Bug Infested Directives : Debugger - Unfixed Bugs : BUG #10 +v 1.1 + +; tempo, swing percent +b 131, 33 + +; chord groups +c 1 + 4, 59, 63, 65, 69, 71, 72, 75, 77, 79, 82 + 4, 59, 63, 65, 69, 71, 72, 75, 77, 79, 82 + +c 2 + 4, 71, 72, 75, 77 + +; sections: section number, length, chordgroup +s 1, 64, 1 +s 2, 64, 1 +s 3, 8, 2 +s 4, 56, 1 +s 5, 32, 2 + + + +i hat1, 1 +; 1 - - - 2 - - - 3 - - - 4 - - - 5 - - - 6 - - - 7 - - - 8 - - - + 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,.8, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1,.6 + 1, 1,.1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,.1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,.2 +i kick, 4, 1 +i kick, 5 +; 1 - - - 2 - - - 3 - - - 4 - - - 5 - - - 6 - - - 7 - - - 8 - - - + 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 + .4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.4,.3 + 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1 + 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1, 1, 1,.4, 1 + + +}} diff --git a/BUG10/bussing.udo b/BUG10/bussing.udo new file mode 100644 index 0000000..78755ce --- /dev/null +++ b/BUG10/bussing.udo @@ -0,0 +1,62 @@ +#ifndef UDO_BUSSING +#define UDO_BUSSING ## + + +/* + Get the stereo L and R names for a singular bus name + + SnameL, SnameR bus_name Sbus + + SnameL left bus identifier + SnameR right bus identifier + + Sbus bus name +*/ +opcode bus_name, SS, S + Sbus xin + xout sprintf("%sL", Sbus), sprintf("%sR", Sbus) +endop + + +/* + Mix to a stereo bus + + bus_mix Sbus, aL, aR + + Sbus bus name + aL left channel + aR right channel +*/ +opcode bus_mix, 0, Saa + Sbus, aL, aR xin + SbusL, SbusR bus_name Sbus + chnmix aL, SbusL + chnmix aR, SbusR +endop + + + +/* + Read from a stereo bus, and then clear the bus + + aL, aR bus_read Sbus + + aL left channel + aR right channel + + Sbus bus name +*/ +opcode bus_read, aa, S + Sbus xin + SbusL, SbusR bus_name Sbus + aL chnget SbusL + aR chnget SbusR + chnclear SbusL + chnclear SbusR + xout aL, aR +endop + + + + +#end diff --git a/BUG10/instruments.udo b/BUG10/instruments.udo new file mode 100644 index 0000000..dcb4ba3 --- /dev/null +++ b/BUG10/instruments.udo @@ -0,0 +1,238 @@ +#ifndef UDO_INSTRUMENTS +#define UDO_INSTRUMENTS ## +/* + Debugger - Unfixed Bugs : BUG #4 + + Sound generators + Names should correspond to those used in BID file, prepended with play_ +*/ + + +#include "wavetables.udo" +#include "bussing.udo" +#include "bid.udo" + +instr play_bass1 + ifreq = cpsmidinn(table(1, gibid_chordfn) - 24) + kindex1 line 4, p3, 1 + kindex2 line 5, p3, 1 + kamp linseg 1, p3*0.9, 1, p3*0.1, 0 + aL foscil 1, ifreq, 8, 1.5, kindex1, gifnSine + aR foscil 1, ifreq, 8, 1.5, kindex2, gifnSine + aL *= kamp * 0.88 + aR *= kamp * 0.88 + bus_mix("master", aL, aR) +endin + +instr play_hit1 + kfreq line cpsmidinn(table(2, gibid_chordfn) - 24), p3, cpsmidinn(table(1, gibid_chordfn) - 24) + kindex1 line 4, p3, 1 + kindex2 line 5, p3, 1 + kamp linseg 1, p3*0.9, 1, p3*0.1, 0 + aL1 foscil 1, kfreq, 1, 1.5, kindex1, gifnSquare + aR1 foscil 1, kfreq, 1, 1.5, kindex2, gifnSquare + aL2 foscil 1, kfreq, 2, 2.5, kindex2, gifnSine + aR2 foscil 1, kfreq, 2, 2.5, kindex1, gifnSine + aL = (aL1 + aL2) * kamp * 0.88 + aR = (aL1 + aL2) * kamp * 0.88 + aL distort aL, 0.6, gifnSine + aR distort aR, 0.6, gifnSine + + knoiseenv line 3, p3, 0.1 + aLn unirand knoiseenv + aRn unirand knoiseenv + aLn butterlp aLn, 5000 + aRn butterlp aRn, 5000 + aL = aLn * aL * 0.1 + aR = aRn * aR * 0.1 + bus_mix("master", aL, aR) +endin + +instr play_melb1 + ifreq = cpsmidinn(table(1, gibid_chordfn)) * 1 + p3 = 0.03 + kindex1 line random(1, 4), p3, random(1, 5) + kindex2 line random(1, 4), p3, random(1, 5) + kamp linseg 0, p3*0.5, 1, p3*0.4, 1, p3*0.1, 0 + aL foscil 1, ifreq, 2, random(1, 4), kindex1, gifnSine + aR foscil 1, ifreq, 2, random(1, 4), kindex2, gifnSine + aL *= kamp * 0.2 + aR *= kamp * 0.2 + bus_mix("master", aL, aR) +endin + + +instr play_hat1 + iamp = bid_getparameter(p4, p5, 2) + p3 = 0.05 + kfreq line 300, p3, 100 + aenv expsega .1, .0005, 1, p3 - .0005, .01 + asqr1 oscil 1, kfreq, gifnSquare, -1 + asqr2 oscil 1, kfreq*1.4471, gifnSaw, -1 + asqr3 oscil 1, kfreq*1.6170, gifnSaw, -1 + asqr4 oscil 1, kfreq*1.9265, gifnSaw, -1 + asqr5 oscil 1, kfreq*2.5028, gifnSine, -1 + asqr6 oscil 1, kfreq*2.6637, gifnSaw, -1 + a808 sum asqr1, asqr2, asqr3, asqr4, asqr5, asqr6 + a808 butterhp a808, 4270 + a808 butterhp a808, 4270 + aout = a808 * aenv * iamp * 2 + bus_mix("master", aout, aout) +endin + +instr play_hat2 + iamp = bid_getparameter(p4, p5, 2) + p3 = 0.12 + idel1 = random(0.005, 0.01) + idel2 = random(0.005, 0.01) + xtratim(max(idel1, idel2)) + + kfreq line 400, p3, 100 + aenv expsega .1, .0005, 1, p3 - .0005, .01 + asqr1 oscil 1, kfreq, gifnSquare, -1 + asqr2 oscil 1, kfreq*1.4471, gifnSine, -1 + asqr3 oscil 1, kfreq*1.5170, gifnSquare, -1 + asqr4 oscil 1, kfreq*1.7265, gifnSquare, -1 + asqr5 oscil 1, kfreq*2.2028, gifnSaw, -1 + asqr6 oscil 1, kfreq*2.4637, gifnSaw, -1 + a808 sum asqr1, asqr2, asqr3, asqr4, asqr5, asqr6 + a808 butterhp a808, 3270 + a808 butterhp a808, 3270 + aout = a808 * aenv * iamp * 1.1 + aL delay aout, idel1 + aR delay aout, idel2 + bus_mix("master", aL, aR) +endin + + + +instr play_kick ; 808 style kick + iamp = bid_getparameter(p4, p5, 2) + + idist = 0.4 ;= (i(gksection) == 1) ? 0.55 : 0.35 + xtratim 0.1 + krelease release + ktune init 0 + kmul transeg 0.2, p3*0.5, -15, 0.01, p3*0.5, 0, 0 + kbend transeg 0.5, 1.2, -4, 0, 1, 0, 0 + asig gbuzz 0.5, 50*octave(ktune)*semitone(kbend), 20, 1, kmul, gifnCosine + aenv transeg 1, p3-0.004, -6, 0 + gkpump = k(aenv) + aatt linseg 0, 0.004, 1 + asig = asig*aenv*aatt + aenv linseg 1, 0.07, 0 + acps expsega 400, 0.07, 0.001, 1, 0.001 + aimp oscili aenv, acps*octave(ktune*0.25) + amix = ((asig*0.7)+(aimp*0.35))*2*iamp + gkpump = min(rms(amix) * 7, 1) + aout1 pareq amix, 100, 0.01, 0.7 + aout1 distort aout1, idist, gifnSine + aout1 pareq aout1, 50, 2, 0.4 + ;aout1 pareq aout1, 190, 0.7, 0.6 + aout1 pareq aout1, 4900, 2, 0.7 + aout1 *= 2 + bus_mix("master", aout1, aout1) +endin + +instr play_kick2 + iamp = bid_getparameter(p4, p5, 2) + xtratim 0.1 + krelease release + ktune init 1 + ifn = gibid_chordgroups[1][1] ; gibid_chordfn + ifreq = cpsmidinn(tab_i(1, ifn) - 18) * 0.1 + kmul transeg 0.2, p3*0.5, -15, 0.01, p3*0.5, 0, 0 + kbend transeg 0.5, 1.2, -4, 0, 1, 0, 0 + asig gbuzz 0.5, ifreq, 20, 1, kmul, gifnCosine + aenv transeg 1, p3-0.004, -6, 0 + aatt linseg 0, 0.004, 1 + asig = asig*aenv*aatt + aenv linseg 1, 0.07, 0 + acps expsega 400, 0.07, 0.001, 1, 0.001 + aimp oscili aenv, acps*octave(ktune*0.25) + amix = ((asig*0.7)+(aimp*0.35))*2*iamp + aout1 pareq amix, 100, 0.01, 0.6 + aout1 distort aout1, 0.6, gifnSquare + aout1 pareq aout1, 100, 0.8, 0.3 + aout1 butterhp aout1, 30 + aout1 *= 3.6 + ;aout1 *= 1-gkpump + bus_mix("master", aout1, aout1) +endin + + +instr play_shaker + iamp = bid_getparameter(p4, p5, 2) + p3 = 0.02 + kamp line 1, p3, 0 + aL shaker 1, 2000, 8, 0.499, 2, 0 + aR shaker 1, 2000, 8, 0.499, 2, 0 + aL *= kamp * iamp * 3 + aR *= kamp * iamp * 3 + bus_mix("master", aL, aR) + bus_mix("delay3", aL*0.25, aR*0.25) +endin + + + + +;glitch sampler vars +giglitchsamples = 44100 +giglitchbufferL ftgen 0, 0, giglitchsamples, 7, 0 +giglitchbufferR ftgen 0, 0, giglitchsamples, 7, 0 +instr play_glitchread + iamp = bid_getparameter(p4, p5, 2) + ifreq = cpsmidinn(tab_i(random(1, ftlen(gibid_chordfn) - 1), gibid_chordfn)) + ilen = ((1/(ifreq))*sr)*pow(2, round(random(0, 4))) + istart random 0, giglitchsamples-ilen + awindex phasor giglitchsamples / ilen + aL table awindex*giglitchsamples, giglitchbufferL + aR table awindex*giglitchsamples, giglitchbufferR + aL butterhp aL, 350 + aR butterhp aR, 350 + aL *= 0.4 * iamp + aR *= 0.4 * iamp + if (random(0, 1) > 0.7) then + if (random(0, 1) > 0.5) then + bus_mix("delay1", aL, aR) + else + bus_mix("delay2", aL, aR) + endif + endif + bus_mix("master", aL, aR) +endin + +instr play_snare + icps0 = 110 + iamp = bid_getparameter(p4, p5, 2) + p3 = 0.3 + icps1 = 4.0 * icps0 + kcps port icps0, 0.007, icps1 + kcpsx = kcps * 1.5 + + kfmd port 0.0, 0.01, 0.7 + aenv1 expon 1.0, 0.03, 0.5 + kenv2 port 1.0, 0.008, 0.0 + aenv2 interp kenv2 + aenv3 expon 1.0, 0.025, 0.5 + + a_ oscili 1.0, kcps + a1 oscili 1.0, kcps * (1.0 + a_*kfmd) + a_ oscili 1.0, kcpsx + a2 oscili 1.0, kcpsx * (1.0 + a_*kfmd) + + a3 unirand 4.0 + a3 = a3 - 1.0 + a3 butterbp a3, 3200, 1500 + a3 = a3 * aenv2 + + a0 = a1 + a2*aenv3 + a3*1.0 + a0 = a0 * aenv1 + a0 butterhp a0, 210 + aout = a0 * iamp * 1.4 + bus_mix("master", aout, aout) + +endin + + +#end diff --git a/BUG10/txt_tools.udo b/BUG10/txt_tools.udo new file mode 100644 index 0000000..eb0cc86 --- /dev/null +++ b/BUG10/txt_tools.udo @@ -0,0 +1,82 @@ +#ifndef UDO_TXTTOOLS +#define UDO_TXTTOOLS ## +/* + Debugger - Unfixed Bugs : BUG #3 + + Text tools +*/ + + +/* + Print a notification prepended with a line of asterisks + + tt_notify Stext + + Stext text to print +*/ +opcode tt_notify, 0, S + Stext xin + Snew = "\n" + iwidth = 60 + index = 0 + while (index < iwidth) do + Snew = strcat(Snew, "*"); + index += 1 + od + prints strcat(strcat(Snew, "\n"), strcat(Stext, "\n\n")) +endop + + + +/* + Print a notification prepended with a line of asterisks and exit + + tt_notify Stext + + Stext text to print +*/ +opcode tt_notify_fatal, 0, S + Stext xin + tt_notify(Stext) + exitnow +endop + + +/* + Return a number of seconds as HH:MM:SS format + + Stime tt_parsetime iseconds + + iseconds seconds to parse + + Stime formatted time + +*/ +opcode tt_parsetime, S, i + input xin + ihours = floor(input / 3600) + iminutes = floor((input - (ihours * 3600)) / 60) + iseconds = input - (ihours * 3600) - (iminutes * 60) + xout sprintf("%02d:%02d:%05.2f", ihours, iminutes, iseconds) +endop + + +/* + Strip newline from end of line: built-in opcode has some problems + + Soutput tt_stripnewline Sinput + + Soutput processed without newline at end if existent + + Sinput line to process +*/ +opcode tt_stripnewline, S, S + Sline xin + index = strindex(Sline, "\n") + if (index != -1) then + Sline = strsub(Sline, 0, index) + endif + xout Sline +endop + +#end diff --git a/BUG10/wavetables.udo b/BUG10/wavetables.udo new file mode 100644 index 0000000..e81f075 --- /dev/null +++ b/BUG10/wavetables.udo @@ -0,0 +1,16 @@ +#ifndef UDO_WAVETABLES +#define UDO_WAVETABLES ## +/* + Debugger - Unfixed Bugs : BUG #3 + + General waveforms +*/ + +ipoints = 16384 +gifnCosine ftgen 0, 0, ipoints, 9, 1, 1, 90 +gifnSine ftgen 0, 0, ipoints, 10, 1 +gifnSquare ftgen 0, 0, ipoints, 10, 1, 0, 0.3, 0, 0.2, 0, 0.14, 0, .111 +gifnSaw ftgen 0, 0, ipoints, 10, 0, .2, 0, .4, 0, .6, 0, .8, 0, 1, 0, .8, 0, .6, 0, .4, 0, .2 + +#end + |