Skip to content

Instantly share code, notes, and snippets.

View ology's full-sized avatar
💭
🤔

Gene Boggs ology

💭
🤔
View GitHub Profile
@ology
ology / .txt
Created April 18, 2025 19:12
Possible Win10 + perl 5.40 list_devices issue?
C:\Users\diamo\Documents\Music-Code>perl list_devices.pl
Use of uninitialized value $path in -d at C:/Strawberry/perl/vendor/lib/FFI/CheckLib.pm line 252.
MidiInWinMM::initialize: no MIDI input devices currently available.
MidiInWinMM::initialize: no MIDI input devices currently available.
Input devices:
@ology
ology / .pl
Last active March 22, 2025 02:04
Two controller controlling...
#!/usr/bin/env perl
# fluidsynth -a coreaudio -m coremidi -g 2.0 ~/Music/FluidR3_GM.sf2
# PERL_FUTURE_DEBUG=1 perl rtmidi-dual.pl
use v5.36;
use MIDI::RtController ();
my $input_name_1 = shift || 'joystick'; # midi controller device
@ology
ology / play.pl
Last active March 11, 2025 20:35
Controller play with mostly correct timing!
elsif ($ev eq 'control_change' && $note == 25 && $vel == 127) { # play
log_it(recording => 'off');
$recording = 0;
if (!$playing && @$events) {
log_it(playing => 'on');
$playing = 1;
my $part = sub {
my (%args) = @_;
my $t = $args{bpm} / 60; # beats per second
for my $i (0 .. $args{events}->$#*) {
@ology
ology / score-filter.pl
Last active March 11, 2025 06:56
WIP: Score ... So far: Silence! :D
sub score ($dt, $event) {
my ($ev, $chan, $note, $vel) = $event->@*;
if ($ev eq 'control_change' && $note == 26 && $vel == 127) { # record
$recording = 1;
log_it(recording => 'on');
}
elsif ($ev eq 'control_change' && $note == 25 && $vel == 127) { # play
log_it(playing => 'on');
if (!$playing && @$events) {
warn __PACKAGE__,' L',__LINE__,' ',,"HELLO?\n";
@ology
ology / out.txt
Created March 4, 2025 08:38
Calling async ScorePlayer
gene@zappa:~/sandbox/Music master> PERL_FUTURE_DEBUG=1 perl rtmidi-callback.pl
Future::IO::_DefaultImpl::F=HASH(0x14db18dd8) was constructed at rtmidi-callback.pl line 349 and was lost near /Users/gene/perl5/perlbrew/perls/perl-5.38.0/lib/site_perl/5.38.0/IO/Async/Internals/TimeQueue.pm line 157 before it was ready.
@ology
ology / rtmidi-callback.pl
Created March 4, 2025 06:03
Trying to make ScorePlayer not block - Grrr!
# ...
sub score_send ($score) {
$loop->add(
IO::Async::Timer::Countdown->new(
delay => 0,
on_expire => sub { $score->play }
)->start
);
}
@ology
ology / out.txt
Created February 20, 2025 19:47
Async sleep no dice?
Tick 0
Tick 1
Can't use an undefined value as a subroutine reference at /Users/gene/perl5/perlbrew/perls/perl-5.38.0/lib/site_perl/5.38.0/IO/Async/Channel.pm line 533.
(in cleanup) Can't call method "ok" on an undefined value at /Users/gene/perl5/perlbrew/perls/perl-5.38.0/lib/site_perl/5.38.0/MIDI/RtMidi/FFI/Device.pm line 203 during global destruction.
shell returned 255
@ology
ology / build.log
Last active February 20, 2025 18:59
cpanm Future::IO ... FAIL
cpanm (App::cpanminus) 1.7047 on perl 5.038000 built for darwin-2level
Work directory is /Users/gene/.cpanm/work/1740077374.80202
You have make /usr/bin/make
You have LWP 6.72
You have /usr/bin/tar: bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.12 liblzma/5.4.3 bz2lib/1.0.8
You have /usr/bin/unzip
Searching Future::IO () on cpanmetadb ...
--> Working on Future::IO
Fetching http://www.cpan.org/authors/id/P/PE/PEVANS/Future-IO-0.16.tar.gz
-> OK
@ology
ology / .pl
Last active February 19, 2025 22:16
Can't puzzle out how to play a note
#!/usr/bin/env perl
use v5.36;
use Data::Dumper::Compact qw(ddc);
use IO::Async::Timer::Periodic;
use IO::Async::Routine;
use IO::Async::Channel;
use IO::Async::Loop;
use Future::AsyncAwait;
@ology
ology / usleep1.txt
Last active February 19, 2025 06:06
What am I missing about using Time::Hires usleep()?
> perl -MTime::Hires=usleep -E'say "Hello"; usleep(1000); say "there."'
Hello
Undefined subroutine &main::usleep called at -e line 1.