BurntToast icon indicating copy to clipboard operation
BurntToast copied to clipboard

[Bug]: Can't create BTAudio with source file

Open jdhitsolutions opened this issue 3 months ago • 5 comments

Checklist

  • [x] I have verified this is the correct repository for opening this issue.
  • [x] I have verified no other issues exist related to my problem.
  • [x] I have, to the best of my knowledge, that this isn't an environmental issue (Sorry, we can't help troubleshoot your infrastructure).

Steps to Reproduce

According to the help documentation, I should be able to create an audio element like this:


$aud = New-BTAudio -Source 'c:\temp\start.mp3'

But instead I get an error.

Expected Behavior

I should create the object.

Actual Behavior

Image

Experience with Toast

None

Environment data: PowerShell

Name                           Value
----                           -----
PSVersion                      7.5.3
PSEdition                      Core
GitCommitId                    7.5.3
OS                             Microsoft Windows 10.0.26200
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Environment data: OS

OsName         : Microsoft Windows 11 Pro
OsVersion      : 10.0.26200
OsArchitecture : 64-bit

Environment data: BurntToast

1.1.0

Consent to Attribution

  • [ ] Please shout me out if I've inspired a blog post!

jdhitsolutions avatar Sep 18 '25 17:09 jdhitsolutions

I think you need to add a parameter or parameter set to allow for a file path so you can keep the existing parameter validation. Or maybe you meant to remove this capability and didn't update the help.

jdhitsolutions avatar Sep 18 '25 17:09 jdhitsolutions

Hey there @jdhitsolutions, thanks for reaching out!

Would you mind pointing me at the docs mentioning that pointing to a custom sound file is still possible? I'll need to get that updated.

Unfortunately, the ability to use a custom sound by just pointing to a file on disk was removed by Microsoft at some point in the Windows 10 lifecycle. From BurntToast's side of things, that option was deprecated in 0.8.1 and then fully removed in v1.0.0 but it's very possible I missed some references in the docs.

Windos avatar Sep 18 '25 21:09 Windos

this also fail:

PS C:\> new-BurntToastNotification -Text "Let's go" -HeroImage C:\scripts\gazoo.bmp -Sound (new-btaudio -Source ms-winsoundevent:Notification.Looping.Alarm4)
New-BurntToastNotification: Cannot validate argument on parameter 'Sound'. The argument "Microsoft.Toolkit.Uwp.Notifications.ToastAudio" does not belong to the set "Default,IM,Mail,Reminder,SMS,Alarm,Alarm2,Alarm3,Alarm4,Alarm5,Alarm6,Alarm7,Alarm8,Alarm9,Alarm10,Call,Call2,Call3,Call4,Call5,Call6,Call7,Call8,Call9,Call10" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
PS C:\> new-BurntToastNotification -Text "Let's go" -HeroImage C:\scripts\gazoo.bmp -Sound (new-btaudio -Source Alarm4)                  
New-BTAudio: Cannot validate argument on parameter 'Source'. The argument "Alarm4" does not belong to the set "ms-winsoundevent:Notification.Default,ms-winsoundevent:Notification.IM,ms-winsoundevent:Notification.Mail,ms-winsoundevent:Notification.Reminder,ms-winsoundevent:Notification.SMS,ms-winsoundevent:Notification.Looping.Alarm,ms-winsoundevent:Notification.Looping.Alarm2,ms-winsoundevent:Notification.Looping.Alarm3,ms-winsoundevent:Notification.Looping.Alarm4,ms-winsoundevent:Notification.Looping.Alarm5,ms-winsoundevent:Notification.Looping.Alarm6,ms-winsoundevent:Notification.Looping.Alarm7,ms-winsoundevent:Notification.Looping.Alarm8,ms-winsoundevent:Notification.Looping.Alarm9,ms-winsoundevent:Notification.Looping.Alarm10,ms-winsoundevent:Notification.Looping.Call,ms-winsoundevent:Notification.Looping.Call2,ms-winsoundevent:Notification.Looping.Call3,ms-winsoundevent:Notification.Looping.Call4,ms-winsoundevent:Notification.Looping.Call5,ms-winsoundevent:Notification.Looping.Call6,ms-winsoundevent:Notification.Looping.Call7,ms-winsoundevent:Notification.Looping.Call8,ms-winsoundevent:Notification.Looping.Call9,ms-winsoundevent:Notification.Looping.Call10" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.

jdhitsolutions avatar Sep 18 '25 21:09 jdhitsolutions

Look at the help and examples for New-BTAudio

jdhitsolutions avatar Sep 19 '25 02:09 jdhitsolutions

You may have a second issue. This works:

New-BurntToastNotification -Text "Wakeup" -Sound Alarm2

Assuming I understand the paradigm, this should work, but fails.

PS C:\> New-BurntToastNotification -Text "Wakeup" -Sound (New-BTaudio -Source ms-winsoundevent:Notification.Looping.Alarm2)
New-BurntToastNotification : Cannot validate argument on parameter 'Sound'. The argument
"Microsoft.Toolkit.Uwp.Notifications.ToastAudio" does not belong to the set "Default,IM,Mail,Reminder,SMS,Alarm,Alarm2,A
larm3,Alarm4,Alarm5,Alarm6,Alarm7,Alarm8,Alarm9,Alarm10,Call,Call2,Call3,Call4,Call5,Call6,Call7,Call8,Call9,Call10"
specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
At line:1 char:50
+ ... eup" -Sound (New-BTaudio -Source ms-winsoundevent:Notification.Loopin ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [New-BurntToastNotification], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,New-BurntToastNotification

And if I try just Alarm2, the parameter validation fails.

PS C:\> New-BurntToastNotification -Text "Wakeup" -Sound (New-BTaudio -Source alarm2)
New-BTAudio : Cannot validate argument on parameter 'Source'. The argument "alarm2" does not belong to the set "ms-winso
undevent:Notification.Default,ms-winsoundevent:Notification.IM,ms-winsoundevent:Notification.Mail,ms-winsoundevent:Notif
ication.Reminder,ms-winsoundevent:Notification.SMS,ms-winsoundevent:Notification.Looping.Alarm,ms-winsoundevent:Notifica
tion.Looping.Alarm2,ms-winsoundevent:Notification.Looping.Alarm3,ms-winsoundevent:Notification.Looping.Alarm4,ms-winsoun
devent:Notification.Looping.Alarm5,ms-winsoundevent:Notification.Looping.Alarm6,ms-winsoundevent:Notification.Looping.Al
arm7,ms-winsoundevent:Notification.Looping.Alarm8,ms-winsoundevent:Notification.Looping.Alarm9,ms-winsoundevent:Notifica
tion.Looping.Alarm10,ms-winsoundevent:Notification.Looping.Call,ms-winsoundevent:Notification.Looping.Call2,ms-winsounde
vent:Notification.Looping.Call3,ms-winsoundevent:Notification.Looping.Call4,ms-winsoundevent:Notification.Looping.Call5,
ms-winsoundevent:Notification.Looping.Call6,ms-winsoundevent:Notification.Looping.Call7,ms-winsoundevent:Notification.Lo
oping.Call8,ms-winsoundevent:Notification.Looping.Call9,ms-winsoundevent:Notification.Looping.Call10" specified by the
ValidateSet attribute. Supply an argument that is in the set and then try the command again.
At line:1 char:71
+ ... tToastNotification -Text "Wakeup" -Sound (New-BTaudio -Source alarm2)
+                                                                   ~~~~~~
    + CategoryInfo          : InvalidData: (:) [New-BTAudio], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,New-BTAudio

jdhitsolutions avatar Sep 19 '25 02:09 jdhitsolutions