This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ^C | |
| KeyboardInterrupt detected. Signaling threads to stop... | |
| ^CTraceback (most recent call last): | |
| File "/Users/gene/sandbox/Music/midi-threads.py", line 44, in <module> | |
| time.sleep(0.5) # keep main thread alive and respond to interrupts | |
| ~~~~~~~~~~^^^^^ | |
| KeyboardInterrupt | |
| During handling of the above exception, another exception occurred: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from datetime import datetime, time, date, timedelta | |
| today = date.today() | |
| print(today) # 2025-09-14 | |
| my_time = time(10, 30, 0) | |
| print(my_time) # 10:30:00 | |
| my_datetime = datetime.combine(today, my_time) | |
| print(my_datetime) # 2025-09-14 10:30:00 | |
| duration_to_subtract = timedelta(minutes=30) | |
| print(duration_to_subtract) # 0:30:00 | |
| new_datetime = my_datetime - duration_to_subtract |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| from collections import defaultdict | |
| from typing import Callable, List, Dict, Any, Optional | |
| class MusicVoiceGen: | |
| def __init__(self, pitches=None, intervals=None, possibles=None, weightfn=None, | |
| contextfn=None, startfn=None, MAX_CONTEXT=1): | |
| if pitches is not None and intervals is not None: | |
| if not isinstance(pitches, list) or not pitches: | |
| raise ValueError("have no pitches to work with") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| unit Shopping; | |
| interface | |
| uses | |
| Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, | |
| Vcl.Controls, Vcl.Forms, Vcl.Dialogs, FireDAC.Stan.Intf, FireDAC.Stan.Option, | |
| FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, | |
| FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.SQLite, | |
| FireDAC.Phys.SQLiteDef, FireDAC.Stan.ExprFuncs, FireDAC.VCLUI.Wait, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ... | |
| sub clock_it ($self, $device, $dt, $event) { | |
| return 0 if $self->running; | |
| $self->running(1); | |
| $self->rtc->send_it(['start']); | |
| $self->rtc->loop->add( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| program PascalsTriangle; | |
| uses crt; | |
| var | |
| triangle: array[1..20, 1..20] of integer; | |
| i, j, n: integer; | |
| begin | |
| clrscr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| program SortStrings; | |
| uses SysUtils; | |
| var | |
| unsorted: array of string; | |
| sorted: array of string; | |
| i, j: Integer; | |
| temp: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}->$#*) { |
NewerOlder