|
Forum Index : Microcontroller and PC projects : PicoMite V6.02.01 betas
| Author | Message | ||||
| JanVolk Guru Joined: 28/01/2023 Location: NetherlandsPosts: 322 |
Why isn't the entire list displayed at once when using PicoMite MMBasic RP2350A V6.02.01b4 and OPTION DISPLAY 50, 100? This only happens with the help command. > help play Play Play ARRAY l%(), r%(), freq [,start] [,end] [,terminationinterrupt] Play FLAC file$ [, interrupt] Play LOAD SOUND array%() Play MODFILE file$ [, interrupt] Play MODSAMPLE Samplenum, channel [,volume] Play MP3 file$ [, interrupt] Play NEXT Play PAUSE Play PREVIOUS Play RESUME Play SOUND Play SOUND chan, M, golfvorm, freq [,vol] Play SOUND chan, L/R/B, U, freq Play SOUND LOAD array%() Play SOUND soundno, channelno, type [, frequentie] [, volume] Play STOP Play TONE left [, right[, dur]] [,interrupt]]] Play VOLUME left, right Play WAV file$ [, interrupt] Play WAV "A:mywav.wav" Play MP3 file$ [, interrupt] '** VS1053 PLAY commando's ** PRESS ANY KEY ... Have a nice day, Jan. |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5723 |
Peter, The 2350 continues to improve. If I may suggest a fix to PicoMite that is really needed, I suggest you improve the abstraction between keywords and variable names. You must have noticed that in the last 3 month there where several people that had problems with variables that had perfectly sensible names, but where detected by MMBasic as keywords. And the number of keywords increases with every increment. I had to adapt older programs for various for these problems, such as HELP and MAP and...) and with 2350 proceeding, it will be increasingly difficult to ensure that 2040 programs will run on 2350. In example, I know that I used FRAME in the thermal camera as a variable, and RAY() in one of my measurement devices. Just a suggestion, Volhout Edited 2026-02-20 20:06 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10998 |
I spent several hours yesterday on this and can't find a solution. One problem is the inferred LET command. When the first thing on a line is matched to a command it is tokenised as the command. If we went back to always using LET then the tokeniser could distinguish. The other insolvable issue is that arrays and functions use the same syntax (). In C arrays use [] and functions use () which allows them to be differentiated. There is no way the tokeniser can differentiate between function sin() and array sin(). Finally if OPTION EXPLICIT was mandatory then there is probably more that could be done but because MMbasic allows inferred variable declarations it limits the options. |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3042 |
When I make such mistakes the colour coding in either the internal editor or MMEdit shows me what I have done wrong. As only a few commands/functions have numbers in their names adding a number to a variable name that might be ambiguous is one way to avoid problems. . Edited 2026-02-20 20:34 by phil99 |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5723 |
Peter, Thanks for looking into it. Phill, A good idea for new code, but not an option for existing code. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| bfwolf Senior Member Joined: 03/01/2025 Location: GermanyPosts: 176 |
One possibility would be to introduce name spacing for all new "non-standard" Basic commands and functions. For example, they could begin with 'MMB.'. This could then be extended to create subcategories such as "MMB.GFX." for graphics commands. This could also be done retroactively for the recently added keywords, since there probably aren't that many programs using them yet. Variable names beginning with 'MMB.' would then be prohibited for users. Regards, bfwolf. |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10998 |
There are relatively few new commands and functions and the recently reported issue was over the use of INPUT so I don't think that solves it. I tried to put a variable analyser in the bit of MMbasic that prepares the program ready for running - finds subroutines etc. but by this time the tokeniser has already run and replaced the "variable" name with a token. It isn't possible to include anything in the tokeniser as it is writing to flash and that conficts with any output, As phil99 says, the colour coding in the editor is the best defence. |
||||
| bfwolf Senior Member Joined: 03/01/2025 Location: GermanyPosts: 176 |
Regarding commands/functions like INPUT/INPUT$(), I completely agree with you. The INPUT command, at least, is reserved in BASIC from the very beginning, and every BASIC programmer should know that variable names like 'INPUT', 'PRINT', 'FOR', etc. are out of the question! If you want to use a variable containing reserved words, you have to prefix it with something like 'V_'. I was referring more to other new commands like 'RAY' – you could use namespacing there and, for example, use 'MMB.RAY' as the command name. And yes: A well-functioning syntax highlighting feature in the editor is incredibly helpful! And if you're about to write a variable that suddenly changes color, you should pause and think, "Whoa, there's a command here?" Regards. |
||||
| homa Guru Joined: 05/11/2021 Location: GermanyPosts: 543 |
Why not enforce a suffix for variables? So we'll stick with foo$, foo%, foo! for strings, 64-bit signed integers and floating point numbers. Personally, I find the code more readable this way and actually use it like this. Matthias |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8618 |
I find nothing wrong with the colour coded editor. I almost always use Option Deault Integer as I'm too lazy and too bad a typist to hit the % key accurately, even when I can find it. :) I'm slightly better with $ and very rarely use floats, only when I need them. To swap variable names in existing programs pop them on a SD card, move it to a PC and use search and replace in your favourite text editor. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4269 |
That wouldn't prevent the mistake with INPUT$ (and may be more hassle than it's worth). John |
||||
| JanVolk Guru Joined: 28/01/2023 Location: NetherlandsPosts: 322 |
Input$() is not only an exception, but these also change to edit after the save command. Call ( Device ( Frame ( Input $( Math ( And the colors of these don't change in edit. MM.CMDLINE$ MM.CODE MM.DEVICE$ MM.DISPLAY MM.ErrMsg$ MM.Errno MM.FLAGS MM.FONTHEIGHT MM.FONTWIDTH MM.HEIGHT MM.HPOS MM.HRES MM.I2C MM.ONEWIRE MM.PERSISTENT MM.PS2 MM.SUPPLY MM.VER MM.VPOS Jan. |
||||
| homa Guru Joined: 05/11/2021 Location: GermanyPosts: 543 |
Peter, please be assured that I am very pleased with the new play sample. I have been experimenting with it a little. It is worth noting that, at this time, it is only monophonic, which means that a new play sample ends the current one. I was wondering whether you had any plans to add polyphony? I was just wondering if that would even work in terms of performance. If I may make a suggestion, it might be beneficial to consider using four to six samples, as I believe this could assist with the melody songs. Of course, 16 or 32 would be a dream come true :-)) Matthias |
||||
| bfwolf Senior Member Joined: 03/01/2025 Location: GermanyPosts: 176 |
So we'll have to be content with being able to recreate a Minimoog synthesizer: https://en.wikipedia.org/wiki/Minimoog Until Peter implements polyphony, and we can then realize a Polymoog: https://en.wikipedia.org/wiki/Polymoog AFAIK Keith Emerson of the legendary prog-rock band ELP also started with a Minimoog.. https://en.wikipedia.org/wiki/Keith_Emerson bfwolf Edited 2026-02-22 19:49 by bfwolf |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8618 |
It'll cost you way more for the Minimoog control knobs than it will for the Pico. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Quazee137![]() Guru Joined: 07/08/2016 Location: United StatesPosts: 603 |
It would be FUN to make something like my old Korg Poly-800 using MMbasic. I use it when doing a review of Music Printer Plus with Jerom Bixby. It came out in the Jan 1990 issue of Electronic Musician. Took us six months because it was so exciting and FUN to play with. I had to stop looking at the screen while playing as the program was notating my key strokes. Jerry had a wall of synths. He could do a 48 piece orchestra and had six big tube amps feeding a wall of custom speakers he made. Quazee137 I found the IBM Music Feature Card but sadly no longer have a system I can put it in. The software is 2 5.25" and 3.5" floppies. Edited 2026-02-22 21:13 by Quazee137 |
||||
| JanVolk Guru Joined: 28/01/2023 Location: NetherlandsPosts: 322 |
I've done further research on my previous report. When I play an MP3 with quick transitions, some passages become distorted. I considered setting the frequency higher, but that doesn't work anymore. I've tried various frequencies. Error message: > option cpuspeed 200000 [39] CSub Error: Invalid identifier This message comes from the help.txt file because I was editing it before, and the help.txt was still in memory, and the MP3 had started from minifm_RC2. I had changed the CPU speed and then received this message, which confused me. The new CPU speed was accepted, so Clear_Flash_RP2350.uf2 was unnecessary. So, if the help.txt is still in memory, it is active and will also be active after a reset, save, or adjustment of the CPU speed. I've noticed that several commands (I've already seen three) in help.txt can cause an error, so I'll have to pay extra attention to this in the future. Another point that really shouldn't be mentioned here is closing minifm_RC2. It hangs in the last folder, and I've adjusted it so that it goes to B:/ when closed and always ends in A:/. Jan. |
||||
| bfwolf Senior Member Joined: 03/01/2025 Location: GermanyPosts: 176 |
I was incredibly lucky to see ELP live at an open-air festival in Lahr/Baden in 1997. You can't imagine how long Keith Emerson spent before each song (e.g. "Lucky Man") tweaking the knobs on the Moog synthesizer to get the sound just right. bfwolf |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10998 |
V6.02.01b5 PicoMiteV6.02.01b5.zip All versions Minor internal bug fixes RP2040 Reduced firmware size for all versions. Extra 16Kb of A: drive for PicoMite and more for VGA and WebMite. This was done by changing the optimisation level in the compilation. This may cause issues so please report any problems and I will revert to the original build. RP2350 PLAY SAMPLE now supports full stereo with different ADSR parameters per channel. The limitation is that notes on the two channels must still be simultaneous. If the right adsr parameters are not specified the right channel inherits the left. PLAY SAMPLE left%(), right%(), freq_L, A_L, D_L, S_L, R_L [, freq_R, A_R, D_R, S_R, R_R] [,interrupt] Test program ' ============================================================ ' PLAY SAMPLE Demo - Independent Stereo ADSR Envelopes ' ============================================================ ' This demo creates single-cycle waveforms and plays them ' using PLAY SAMPLE with the extended stereo syntax: ' ' Basic (same envelope both channels): ' PLAY SAMPLE left%(), right%(), freq, A, D, S, R [,intr] ' ' Extended (independent L/R frequency and ADSR): ' PLAY SAMPLE left%(), right%(), ' freq_L, A_L, D_L, S_L, R_L, ' freq_R, A_R, D_R, S_R, R_R [,intr] ' ' The left channel carries the melody with a piano ADSR. ' The right channel carries a harmony with a string ADSR ' (slow attack, high sustain, long release). ' ' PLAY RELEASE triggers both channels' release phase. ' PLAY STOP stops immediately. ' ============================================================ Option Base 0 Const CYCLE_LEN = 256 ' samples per single cycle Const AMPLITUDE = 32000 ' peak amplitude (16-bit signed) Dim INTEGER left%(CYCLE_LEN - 1) Dim INTEGER right%(CYCLE_LEN - 1) ' --- Build a single-cycle sine wave --- For i% = 0 To CYCLE_LEN - 1 left%(i%) = Int(Sin(2 * Pi * i% / CYCLE_LEN) * AMPLITUDE) right%(i%) = left%(i%) Next i% ' ============================================================ ' Example 1: Basic mono playback (same ADSR both channels) ' ============================================================ Print "Example 1: Clean 440 Hz sine, 2 seconds..." Print " Attack=0 Decay=0 Sustain=100% Release=0" Play Sample left%(), right%(), 440, 0, 0, 100, 0 Pause 2000 Play Stop Print "Done." ' ============================================================ ' Example 2: Piano-style envelope at middle C ' ============================================================ Print "Example 2: Piano tone at 262 Hz (middle C)..." Print " Attack=5ms Decay=300ms Sustain=20% Release=500ms" Play Sample left%(), right%(), 262, 5, 300, 20, 500 Pause 3000 Play Release Pause 600 Print "Done." ' ============================================================ ' Example 3: Independent stereo - left piano, right string ' Both play the same pitch (A4 = 440 Hz) ' ============================================================ ' Demonstrates independent ADSR per channel at one pitch. ' Left = Piano : fast attack, moderate decay, low sustain ' Right = String: slow attack, gentle decay, high sustain Print "Example 3: Same pitch, different envelopes (stereo)..." Print " LEFT (piano): freq=440 A=5 D=300 S=20 R=500" Print " RIGHT (string): freq=440 A=150 D=200 S=75 R=800" Play Sample left%(), right%(), 440, 5, 300, 20, 500, 440, 150, 200, 75, 800 Pause 3000 Play Release Pause 900 Print "Done." ' ============================================================ ' Example 4: Stereo interval - left root, right fifth above ' Left = C4 piano, Right = G4 string ' ============================================================ Print "Example 4: Stereo fifth - C4 piano (L) + G4 string (R)..." Print " LEFT (piano): freq=261.6 A=5 D=300 S=20 R=500" Print " RIGHT (string): freq=392.0 A=150 D=200 S=75 R=800" Play Sample left%(), right%(), 261.6, 5, 300, 20, 500, 392.0, 150, 200, 75, 800 Pause 3000 Play Release Pause 900 Print "Done." ' ============================================================ ' Example 5: Chromatic scale - piano left, string third right ' ============================================================ ' The left channel plays a chromatic scale with a piano ADSR. ' The right channel plays a major third above with a string ' ADSR (the interval ratio is 5/4 = 1.2599). Print "Example 5: Chromatic scale with stereo harmony..." Restore scale_data For note% = 1 To 13 Read freq! harm! = freq! * 1.2599 ' major third above Print " L="; freq!; "Hz R="; harm!; "Hz" ' Left=piano(A=5,D=150,S=30,R=300) Right=string(A=120,D=150,S=75,R=500) Play Sample left%(), right%(), freq!, 5, 150, 30, 300, harm!, 120, 150, 75, 500 Pause 500 Play Release Pause 550 Next note% Print "Scale complete." ' ============================================================ ' Example 6: Twinkle Twinkle Little Star ' Left channel = melody (piano ADSR) ' Right channel = harmony a third above (string ADSR) ' ============================================================ ' Piano ADSR: Attack=5ms Decay=150ms Sustain=30% Release=200ms ' String ADSR: Attack=150ms Decay=200ms Sustain=75% Release=800ms ' ' Melody in C major with harmony a diatonic third above: ' C->E D->F E->G F->A G->B A->C5 Print "Example 6: Twinkle Twinkle - piano melody (L) + string harmony (R)..." Restore twinkle_harmony For note% = 1 To 42 Read mfreq!, hfreq!, dur% If mfreq! = 0 Then ' Rest Pause dur% Else Print " melody="; mfreq!; "Hz harmony="; hfreq!; "Hz dur="; dur%; "ms" Play Sample left%(), right%(), mfreq!, 5, 150, 30, 200, hfreq!, 150, 200, 75, 800 Pause dur% Play Release Pause 250 EndIf Next note% Print "Tune complete." End done: ' Interrupt handler for end of release SamplePlaying% = 0 IReturn ' Frequencies for one chromatic octave (A4 to A5) scale_data: Data 440.0, 466.2, 493.9, 523.3, 554.4, 587.3, 622.3 Data 659.3, 698.5, 740.0, 784.0, 830.6, 880.0 ' Twinkle Twinkle Little Star with diatonic third harmony ' Each triple: melody freq, harmony freq, duration (ms) ' C4=261.6 D4=293.7 E4=329.6 F4=349.2 G4=392.0 A4=440.0 B4=493.9 C5=523.3 ' ' Line 1: C C G G A A G- ' Harmony: E E B B C5 C5 B twinkle_harmony: Data 261.6, 329.6, 350, 261.6, 329.6, 350 Data 392.0, 493.9, 350, 392.0, 493.9, 350 Data 440.0, 523.3, 350, 440.0, 523.3, 350 Data 392.0, 493.9, 700 ' Line 2: F F E E D D C- ' Harmony: A A G G F F E Data 349.2, 440.0, 350, 349.2, 440.0, 350 Data 329.6, 392.0, 350, 329.6, 392.0, 350 Data 293.7, 349.2, 350, 293.7, 349.2, 350 Data 261.6, 329.6, 700 ' Line 3: G G F F E E D- ' Harmony: B B A A G G F Data 392.0, 493.9, 350, 392.0, 493.9, 350 Data 349.2, 440.0, 350, 349.2, 440.0, 350 Data 329.6, 392.0, 350, 329.6, 392.0, 350 Data 293.7, 349.2, 700 ' Line 4: G G F F E E D- ' Harmony: B B A A G G F Data 392.0, 493.9, 350, 392.0, 493.9, 350 Data 349.2, 440.0, 350, 349.2, 440.0, 350 Data 329.6, 392.0, 350, 329.6, 392.0, 350 Data 293.7, 349.2, 700 ' Line 5: C C G G A A G- ' Harmony: E E B B C5 C5 B Data 261.6, 329.6, 350, 261.6, 329.6, 350 Data 392.0, 493.9, 350, 392.0, 493.9, 350 Data 440.0, 523.3, 350, 440.0, 523.3, 350 Data 392.0, 493.9, 700 ' Line 6: F F E E D D C- ' Harmony: A A G G F F E Data 349.2, 440.0, 350, 349.2, 440.0, 350 Data 329.6, 392.0, 350, 329.6, 392.0, 350 Data 293.7, 349.2, 350, 293.7, 349.2, 350 Data 261.6, 329.6, 700 Edited 2026-02-23 19:22 by matherp |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5723 |
@Peter, b5 is at least 10% slower than b4 on RP2040 VGA (petscii, rocks). Please keep b4 optimizations. The 16kbyte A:/drive is not worth it. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |