Why teams use PyRIT audio converters for speech model testing
Teams use PyRIT's audio converters when a voice assistant or speech-to-text pipeline accepts audio, because a text-only red teaming run never exercises that input path. A harmful or policy-violating request that a model refuses in typed text may reach a different code path when it arrives as speech, after transcription, or mixed into a recording. The audio converters let you take the same attack objectives your team already uses and carry them through the audio channel, so the test covers what the system actually accepts from users. According to PyRIT's documentation on converters, PyRIT's audio converters cover text-to-audio, audio-to-text and audio-to-audio transformations, which together map to the three main stages of a speech pipeline: input synthesis, transcription and signal modification.
For a test plan, the practical question is which of those stages your product exposes. A system that only transcribes uploaded recordings needs text-to-audio conversion to build test inputs, and a system that answers spoken questions also needs audio-to-text handling to read back what the model returned. Audio-to-audio transformations matter where the product is sensitive to how audio is delivered, such as background noise, speed or volume changes, which real callers and devices introduce. Confirm the exact converter names, parameters and supported formats on the PyRIT audio converters page before you write the plan, because the set of options can change between releases.
Before committing to this approach, decide who owns the audio pipeline's test scope. The engineers who run the speech service need to agree which stages are in scope, which speech service the converters will call, and how transcripts will be scored. Ask for a written list of the converters your version of PyRIT provides, and check that the output of each stage can be stored in PyRIT memory so results are traceable later.
What the three audio converter directions do
PyRIT's audio converters fall into three directions: text-to-audio, audio-to-text and audio-to-audio. Each one answers a different question about a speech system, and they are often combined in a single test run, so the choice of direction shapes both the attack and the evidence you collect.
Text-to-audio: spoken attack prompts
This direction takes a text objective from your dataset and synthesizes it as speech, so the target receives the same request as a voice input. It matters because a text filter can pass a request that a speech pipeline then accepts after recognition. Check which text-to-speech service the converter calls, which voices and languages it can produce, and whether the synthesized audio is stored with the conversation in memory. Confirm exact class names and parameters in the 1.1.0 documentation before you build the pipeline.
Audio converters docsAudio-to-text: transcribing target replies
When a speech model answers with audio, scorers need text to evaluate. This direction transcribes the spoken response so the same scoring logic used for text targets can judge it. The main risk is transcription error: a misheard word can change a refusal into a compliance signal or hide a harmful phrase. Ask how the converter handles accents, background speech and multiple speakers, and keep the original audio alongside the transcript so a reviewer can check disputed results.
Converters docsAudio-to-audio: perturbing existing clips
This direction applies changes to an audio clip that already exists, such as adding echo, background noise, speed changes or volume shifts. It tests whether the target's safety behavior holds when the input is degraded, accelerated or quieter than a clean studio recording. Each perturbation should be a separate, named variable so that a change in outcome can be traced to one factor. Confirm which effects the current release offers and their parameter ranges.
Converter chaining across directions
Real test paths often chain directions: text becomes speech, speech passes through a perturbation, and the target's reply is transcribed for scoring. Each hop adds a point of failure, including synthesis quality, recognition errors and format conversion. Record the output of every converter stage in memory so a failed run can be diagnosed at the hop where the content changed. Keep the chain short at first so that the baseline result is interpretable.
Dependencies and credentials per direction
Text-to-audio and audio-to-text usually depend on an external speech service, which means credentials, regional endpoints and usage charges apply to those directions. Audio-to-audio may run locally, depending on the effect and the library used. Plan credential storage in ~/.pyrit/.env before the first run, and ask your speech provider which costs are one-time setup and which recur with each test. These dependencies decide where audio data travels, so confirm the data handling terms of any hosted service.
Echo, noise, speed and volume changes and when each fits
Echo adds delayed, attenuated copies of the speech on top of the original signal, which imitates a reflective room or a poor acoustic path. The speech content stays the same, but the copies overlap with later syllables and can blur word boundaries. Use echo when the question is whether a speech model keeps its accuracy in reverberant environments such as large halls, open offices or speakerphone calls.
- What changes: the timing of the signal, since delayed repeats overlap the original speech.
- Robustness question: does transcription hold when word boundaries are smeared by reverberation?
- Typical fit: voice assistants, meeting transcription and call center models deployed in untreated rooms.
- Watch for: repeated or garbled words in the transcript that look like model errors but come from the signal itself.
- Scope: the delay and decay settings control how strong the effect is, so record them with each test run.
Confirm the echo parameters available in your PyRIT version before you write test cases that depend on them.
Noise mixes an additional signal into the speech, such as broadband hiss or ambient chatter, so the speech is partly masked. The words are still present, but the model must separate them from interference. Noise tests answer whether a speech model holds up on real microphones and in busy environments such as vehicles, factory floors or public spaces.
- What changes: the signal-to-noise ratio, because the target speech competes with added sound.
- Robustness question: does the model still transcribe or act on the intended words when background sound is present?
- Typical fit: command-and-control interfaces, in-car assistants and field-service voice tools.
- Watch for: failures on speech that a human listener would still understand, which points to a real robustness gap.
- Scope: the noise type and level determine how hard the test is, so document both.
Check the noise options your PyRIT version exposes and decide in advance which noise levels you consider acceptable for your use case.
Speed changes alter the playback rate of the speech, which shifts the pitch and compresses or stretches the timing of phonemes. Faster audio packs more words into less time, and slower audio spreads them out. This tests whether a speech model tolerates unusual pacing from speakers who talk quickly, slowly or with accents that differ from the training data.
- What changes: the duration and pitch of the signal, which moves the speech away from typical timing.
- Robustness question: does accuracy hold when pace varies across speakers and recording conditions?
- Typical fit: dictation, transcription of recorded interviews and customer service audio with fast or hesitant speakers.
- Watch for: errors that cluster at the faster setting, which often indicate a timing sensitivity in the model.
- Scope: large changes can make speech hard for a person to follow, so confirm the content is still intelligible before scoring the result.
Record the rate applied to each sample so results can be compared across runs.
Volume changes scale the amplitude of the speech, making it louder or quieter without altering its content or timing. Quiet speech is a common condition in real deployments, such as a speaker far from the microphone or an automatic gain control that is set low. Volume tests show whether the model's input handling or its voice activity detection breaks down at lower levels.
- What changes: the amplitude of the signal, while timing and content stay fixed.
- Robustness question: does the model still detect and transcribe speech when it is quiet, or clip and distort when it is loud?
- Typical fit: microphones with variable gain, distant-talker scenarios and pipelines with automatic gain control.
- Watch for: missed utterances at low levels and distortion artifacts at high levels, both of which affect downstream decisions.
- Scope: volume is the easiest effect to isolate, so it works well as a baseline before you stack other modifications.
Confirm how your pipeline normalizes audio before the target sees it, because that step can hide or amplify a volume effect.
PyRIT lets you combine audio modifications in sequence, so one test can apply echo, noise, speed and volume changes together. Stacking is useful for approximating a hostile or messy environment, but each added effect increases the chance that the transcription or the model input degrades to the point where the test no longer means what you intended. A failure may then reflect unintelligible audio rather than a model weakness.
- Start with one effect: establish a baseline for each modification before combining them.
- Add effects deliberately: change one variable at a time when you want to find which effect causes a failure.
- Check the intended content: transcribe the modified audio and confirm the target still receives the words your attack depends on.
- Record the order: the sequence of effects affects the result, so log it with each run.
- Compare with a clean control: keep an unmodified version of each prompt to separate model errors from signal damage.
Before you report any result, confirm that a human listener and a transcription check both recover the intended content from the modified audio.
Audio converter options and the decision each one supports
This table compares the main choices for speech model testing: how text becomes audio, how audio becomes text, and where audio effects sit in the chain. Read each row as a decision point, then confirm the listed items in your own environment before committing to one option.
| Decision | Option | When it fits | What to confirm |
|---|---|---|---|
| Text-to-audio source | Azure Speech | You want a managed voice service that PyRIT's converter already targets and your tenant can reach it. | Available voices and languages for your test prompts, the credentials type, and where audio is processed relative to your data residency rules. |
| Text-to-audio source | Speech synthesis you already run | Your team operates a synthesis engine that matches the voices your product uses, so tests reflect production audio. | Whether you can write a custom converter or endpoint wrapper for it, and that its output format matches what the target accepts. |
| Transcription | Azure Speech | The target's responses or your audio inputs are in languages and accents Azure Speech handles well, and cloud processing is allowed. | Language support, speaker and noise handling for your test audio, credential setup, and the data handling terms for submitted audio. |
| Transcription | Local transcription model | Audio cannot leave your network, or you need a fixed model version that your team can pin and review. | Model license, hardware needs, accuracy on your languages, and how the output is wired back into PyRIT as text. |
| Audio effects order | Effects applied before synthesis | You want to test whether a speech model's input filtering reacts to changes in the spoken text itself. | Which effects the converter supports at the text stage, and whether the altered speech remains intelligible to the target. |
| Audio effects order | Effects applied after synthesis | You want to test robustness to echo, noise, speed or volume changes in audio the target would receive from a real channel. | Effect parameters you need to record for reproducibility, and that the output format still meets the target's input requirements. |
How to set up audio converters in a PyRIT test environment
This sequence takes a test environment from a clean Python install to a verified speech round trip, where a text attack is converted to audio, sent to the target and checked by transcription. Each step ends with a check so the team knows the setup works before running real tests.
Confirm a supported Python version
The engineer running the tests checks the Python version on the machine that will run PyRIT. The PyPI package supports Python 3.10 up to but not including 3.15, and the PyRIT documentation recommends Python 3.13, so teams should pick a version in that range and use a virtual environment for the test work. The step is complete when the interpreter reports a version inside the supported range and the environment activates without errors.
Install PyRIT from PyPI
Install the package into the active virtual environment with pip, using the package name pyrit from PyPI. Install from the official index rather than a copied wheel so the version can be recorded and reproduced later. The step is complete when pip reports a successful install and importing the package in a Python shell runs without an import error. Record the installed version in the team's test notes.
Store Azure Speech credentials in the env file
Create the file ~/.pyrit/.env and add the Azure Speech key and region values that the speech target needs, following the variable names in the PyRIT audio converter documentation. Keep the file readable only by the test account, and do not commit it to a repository or paste it into a shared chat. The step is complete when the file exists with the expected variable names and its permissions restrict access to the operator. Confirm the exact variable names with the current documentation before saving.
Set shared settings in the pyrit configuration file
Create ~/.pyrit/.pyrit_conf and add the settings that apply to every run, such as the memory location and default target choices, keeping secrets out of this file because they belong in the env file. Setting the memory location explicitly makes it easier to find conversations and results later for review. The step is complete when a test script loads PyRIT and reports the memory location and settings you expect, with no missing-setting warnings.
Configure a speech target
Define the Azure Speech target in your test script or configuration, pointing it at the speech service region and voice you plan to test, and confirm that the target can be created without authentication errors. Choose a voice that matches the model under test, since voice choice affects what the transcription step can recover. The step is complete when the target object instantiates and a single health-check request to the service returns a successful response.
Run a text-to-audio conversion and confirm the file
Pass one short, harmless test sentence through the text-to-audio converter and write the result to a file in a known output folder. Open the file in an audio player and confirm it plays, has the expected length for the sentence, and contains clearly spoken words. The step is complete when the file exists, plays correctly and its format matches what the converter reported. Use a benign sentence for this check so the setup test does not depend on any harmful prompt.
Run a transcription round trip and check the text
Send the audio file from the previous step through the audio-to-text converter and compare the transcript with the original sentence. Small differences in punctuation or casing are expected, but missing or swapped words suggest an audio quality, voice or service issue to fix before testing. The step is complete when the transcript matches the source text closely enough that a reviewer agrees the round trip is faithful, and the result is saved in memory for the record.
How a text objective becomes audio and back into a scored response
The run starts with a text objective that a text-to-audio converter turns into speech, optionally passed through audio effects such as echo, noise, speed or volume changes. The audio goes to the speech target endpoint, and the audio response returns through an audio-to-text converter so a scorer can judge the text. Every result is written to PyRIT memory. Check where the audio leaves your test host and where credentials are read, because the speech service and the target may sit outside your network.
Audio path from a text objective through the speech target to memory.
Security and data handling risks in audio testing
Audio tests move prompts through speech services, store transcripts and audio in PyRIT memory, and leave generated files on disk. Each of the cards below is a point where sensitive material can leave your control or persist longer than planned, so settle these decisions before the first test run.
Azure Speech credentials and key handling
Text-to-audio and transcription calls to Azure Speech authenticate with a key or identity that PyRIT reads from its environment configuration. Keep the key out of notebooks, shared repositories and logs, and store it in a secrets manager where your team already keeps service credentials. Use a key scoped to a test resource, and rotate it on the schedule your security policy sets. Confirm which authentication methods your PyRIT version supports before choosing one.
Audio converters docsSensitive data in PyRIT memory
PyRIT stores conversations and results in SQLite or Azure SQL, and audio-derived transcripts land there too. A test prompt that embeds a realistic customer record, or synthetic personal data built to look real, becomes a persistent record in that database. Decide who can read the memory store, where it lives and whether it falls under your data classification rules. Use synthetic identifiers that cannot be confused with live data.
Audio sent to a cloud speech service
When you convert text to speech or transcribe audio with Azure Speech, the content of each prompt leaves your environment and is processed by the provider. Confirm with the speech provider how audio and transcripts are processed, whether they are retained, and whether they are used to improve services. Check that the region you select matches your data residency commitments before any sensitive test material is sent.
Retention and deletion of generated audio
Converters write synthesized and modified audio files to a storage location, and those files persist after the run ends unless something removes them. Define where output files are written, how long they are kept and who deletes them. Include the audio directory and the memory database in your cleanup routine, and verify deletion, because a copy left in a shared folder can outlast the test that created it.
Reporting PyRIT vulnerabilities
If you find a vulnerability in PyRIT itself, rather than in the system under test, do not open a public issue. Report it privately through the Microsoft Security Response Center under the project's security policy. Keep proof-of-concept audio and payloads inside your team until the report is acknowledged. Track the PyRIT version you run, since a fix can arrive in a later release.
PyRIT on GitHubQuestions teams ask before testing speech models with PyRIT
How much more effort does audio red teaming add compared with text testing?
Audio testing adds work at every stage, so expect more effort than a text run with the same objectives. Text prompts go straight to the target, while audio prompts must be synthesized, played into the target, and the response transcribed before any scorer can judge it. The main drivers are transcription accuracy, because a misheard word can change the meaning of a response, effect stacking, because each added echo, noise or speed change multiplies the variants to review, and reviewer time, because people often need to listen to samples to confirm what the model actually heard. Ask a partner to size these three drivers against your objectives before agreeing on a scope.
Can an internal team run audio converter tests on its own?
Yes, if the team has Python skills, access to the speech model or its endpoint, and credentials for the speech service it chooses to use. PyRIT is installed with pip, and the audio converters are used from Python code alongside the other PyRIT components. Engineers need to be comfortable with targets, converters, scorers and memory, plus basic audio handling such as file formats and sample rates. Teams new to red teaming often find the hardest part is designing objectives and judging results, not running the code. Start with a small set of objectives and one target before adding converters.
What does a partner need from our side to start?
A partner needs enough access and clarity to test the real system without guessing. Typically this includes a test environment or agreed test endpoint for the speech model, the endpoint details and authentication method, the speech service and region you want used, and written data rules covering what audio and transcripts may be stored, where, and for how long. You should also define test objectives, such as which harms or behaviors matter, and who reviews results. Agree these in a written scope before work starts, so that the test plan, deliverables and timeline are fixed in advance.
Is Azure Speech required to use PyRIT audio converters?
Azure Speech is one option for the text-to-audio and audio-to-text steps, but confirm the current list of supported services in the PyRIT documentation before you design around it. The audio converter documentation describes text-to-audio, audio-to-text and audio-to-audio transformations, and the exact service choices depend on the PyRIT version you install. If your organization has data rules that restrict which cloud services can process audio, check those rules against the converter options in the release you plan to use, and record that decision in your test plan.
How do we know whether transcription errors affected our results?
Compare a sample of transcripts with the audio a human actually heard, and record the error rate for the specific phrases your objectives depend on. If the transcription changed a key word, a negation or a number, the target may have responded to something other than the intended attack, so that result should not count as a clear pass or fail. Keep the original audio, the transcript and the response together in memory so a reviewer can trace each finding. Repeat tests on the clean converted audio before concluding that a model is safe or unsafe against a given technique.
What drives the cost of audio testing, and what should a quote include?
The main recurring costs are speech service usage, which scales with the number of audio clips generated and transcribed, and the time reviewers spend listening to and checking results. Fixed costs include the initial setup, environment work and the design of objectives. A quote should list the number of objectives and converter combinations in scope, the speech service and volume assumed, the review method and reviewer hours, the retest rounds included, and who pays the speech service bills. DeployOpen provides these items as a fixed-scope written quote once the scope is agreed.
Limits to confirm in your environment
Audio converters add several places where a test can fail for reasons unrelated to the target's safety. Confirm each of the points below in the release you install and against your own speech service before you treat a pass or fail as meaningful.
Supported audio formats and sample rates
Converter output depends on the container, codec and sample rate that the converter and your speech target accept. Check which formats the converter writes, whether it resamples, and whether the target rejects files it does not expect. A file the target cannot decode produces an error rather than a model response, so a clean run tells you nothing about the model. Confirm this with a short test file that the target accepts before you build a full test set.
Audio converters docsSpeech services and languages
Text-to-audio and transcription depend on which speech service the converter calls and which languages that service supports in your region. Confirm the service, the voices or languages available in your deployment, and any credential or endpoint setup the converter needs. A language your service does not cover will produce poor audio, and any result from that run should be excluded from your findings.
Python and PyRIT release support
The PyPI package supports Python 3.10 up to but not including 3.15, and the documentation recommends Python 3.13. Pin the PyRIT release you test with, since converter names, parameters and defaults can change between releases. PyRIT v1.1.0 was released on 4 September 2026, so check the converter page for that version before you copy examples from older material.
PyPI packageTranscription error in scoring
When a response is converted back to text, the transcript may differ from what the model actually said. Speech recognition can mishear accents, background noise or the audio effects you added, which can hide a harmful answer or create one that was never spoken. Compare transcripts against the original audio on a sample of runs, and decide whether a scorer that reads transcripts can be trusted for the harm category you test.
Whether the target accepts audio input
Many speech products accept audio only through a specific client, a streaming protocol or a separate transcription step, and some accept audio but return text only. Confirm that your target takes audio input directly, what response format it returns, and whether it applies its own safety filters to spoken input. If the target only transcribes before the model sees the prompt, your test covers the transcription path rather than the model.
How DeployOpen scopes and delivers PyRIT audio testing
DeployOpen treats PyRIT audio testing as a bounded security exercise: first agreeing which speech paths, converters and harms are in scope, then building and running the test harness in your environment. The result is a documented set of runs, findings and retest evidence that your security and product teams can review.
How we scope
- Identify which speech models, voice interfaces and transcription paths the test must reach
- Agree which audio converters apply, such as text-to-audio, audio-to-text and audio-to-audio transformations
- Write the scope, deliverables and timeline down before testing starts, since engagements are fixed-scope
How we build
- Configure PyRIT targets and Azure Speech access using credentials kept out of source control and config files
- Build the audio attack sets, pairing echo, noise, speed and volume changes with the objectives agreed in scope
- Test the harness on a known-safe target first to confirm transcription and converted audio behave as expected
How we hand over
- Deliver the runnable PyRIT configuration, attack definitions and scoring setup for your team to keep
- Provide a findings report covering reproduced results, affected converters and recommended fixes
- Document the memory records and conversation exports so your compliance reviewers can follow each test
How we support
- Retest after fixes are applied to confirm whether the audio bypasses are closed
- Offer ongoing testing and support as a retainer when speech models change or new releases arrive
- Confirm with your team which PyRIT version and Python runtime your environment is approved to run

